question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Per-face colors in plot_trisurf

See original GitHub issue

The docs for pylab.plot_trisurf state that triangles is of shape (N,3) and that color should also be of shape (N, 3), implying that the colors will apply to the triangle faces, not the vertices.

However, the observed behavior (on version 0.4.0a2 from PyPI) is to color the vertices.

colors = np.ones((4,3))*.3
colors[0, 2] = 1.0
colors[3, 2] = 1.0
plot_trisurf([0, 0, 3., 3.], [0, 4., 0, 4.], [1, 0., 0, 1.], 
                triangles=[[0, 2, 3], [0, 3, 1]], color=colors)
screen shot 2017-08-08 at 11 07 16 pm

If the above behavior is as intended? If so, is there another way to set the triangle face color directly?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
maartenbreddelscommented, Aug 11, 2017

Thanks, I’ll keep this open and dive into it later, maybe it is possible more efficiently.

0reactions
maartenbreddelscommented, Sep 12, 2018

I think this can be done at the kernel side first, I guess face_colors and triangle_colors arguments to plot_* would need to sort out the duplication of vertices manually.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tri-Surface Plot in Python using Matplotlib - GeeksforGeeks
cmap, color map to set the color of surface patches ... 1: Let's create a basic Tri-Surface plot using the ax.plot_trisurf() function.
Read more >
Simple surface plots
Some of the different options for producing surface plots are illustrated by the code below. import numpy as np import matplotlib.pyplot ...
Read more >
3D surface (colormap) — Matplotlib 3.6.2 documentation
Demonstrates plotting a 3D surface colored with the coolwarm colormap. The surface is made opaque by using antialiased=False .
Read more >
3D Surface Plots - Problem Solving with Python
Surface plots are created with Matplotlib's ax.plot_surface() method. By default, surface plots are a single color. The general format of Matplotlib's ax.
Read more >
How to plot a 3D Surface Triangulation Plot in Python?
Axes.plot_trisurf(*args, color=None, norm=None, vmin=None, vmax=None, ... X, Y, Z: Data values as 1D arrays. color: Color of the surface patches.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found