matplotlib 3D: interpolated shading

Dear List,

is it possible to not only assign once color per polygon that is
plotted, but one color for each vertex, so that the result looks like
a properly smooth function. Even if I sample the points closely
enough, in the current approach in almost all of your examples you
always see the underlying grid (plus it gets very slow in 3D). I don't
really care much if you interpolate the colors on the 2D projection of
the polygon or on the real 3D polygon, just any color interpolation is
better than none.

What do you actually understand behind the "antialiasing" parameter of
34D plots. It just puzzles me to have such a concept without have a
concept of pixel shading (and thus an easy way for the above
interpolation).

I noticed that even 2D plots from matplot lib are very pixel dominated:
http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo.html

But there is the function imshow which doesn't have this artifacts:
http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo2.html

So is it possible to do something like imshow for 3D as well?

-Holger

Dear List,

is it possible to not only assign once color per polygon that is

plotted, but one color for each vertex, so that the result looks like

a properly smooth function. Even if I sample the points closely

enough, in the current approach in almost all of your examples you

always see the underlying grid (plus it gets very slow in 3D). I don’t

really care much if you interpolate the colors on the 2D projection of

the polygon or on the real 3D polygon, just any color interpolation is

better than none.

What values for rstride and cstride are you using? By default, plot_surface() will sample every 10th point of the data array (for performance reasons). Also, color interpoltion can be turned on by setting shade to True.

What do you actually understand behind the “antialiasing” parameter of

34D plots. It just puzzles me to have such a concept without have a

concept of pixel shading (and thus an easy way for the above

interpolation).

Again, plot_surface() has a shade kwarg. Use it and let me know if it meets your expectations.

I noticed that even 2D plots from matplot lib are very pixel dominated:

http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo.html

But there is the function imshow which doesn’t have this artifacts:

http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo2.html

for pcolor(), you can set the antialiaseds kwarg to True. The only reason why imshow looks good in the second example is because the interpolation was set to bilinear, and I think that automatically sets antialiasing to True.

So is it possible to do something like imshow for 3D as well?

imshow() in 2d was not designed in such a way to yet be used in 3d, but I think there is already a feature request filed for that.

Try shade=True for plot_surface() and see how that looks for you.

Cheers!
Ben Root

···

On Fri, Sep 30, 2011 at 4:27 AM, Holger Brandsmeier <holger.brandsmeier@…3803…> wrote: