python,matplotlib,contour,colormap,contourf

This answer is taken almost entirely from the contour demo example: import numpy as np import matplotlib.cm as cm import matplotlib.mlab as mlab # for setting up the data import matplotlib.pyplot as plt # set up example data: delta = 0.025 x = np.arange(-3.0, 3.0, delta) y = np.arange(-2.0, 2.0,...

If your goal is just to visualise the triangles then there is another way that's probably simpler and more robust (see the end of this post). If you definitely need to generate contours then you will need to interpolate your triangular mesh over a grid. You can use the scatteredInterpolant...

At a guess, I would say that you need to have an amount of rows per color proportional to the size of each range. So 0->0.683 is a lot bigger than 0.683->0.9545. In your color map you have provided only one row each so Matlab assumes that those colors should...

matlab,plot,ellipse,colormap,contourf

Here is a way using built-in colormaps in Matlab (look here for a complete list). The trick is to create a n x 3 array where n is the number of colors you wish to represent. Here it's the number of ellipses. You can create a colormap like so: MyColorMap...

size= 4 X = np.array([np.zeros(size), np.ones(size)]) Y = X.copy().T will get the output you want. But if you're using meshgrid, aren't you feeding functions that expect the format meshgrid produces? ...

python,matplotlib,plot,figure,contourf

Without your data we can't see what the plot is supposed to look like, but I have some general recommendations. Don't use pylab. And if you absolutely must use it, use it within its namespace, and don't do from pylab import *. It makes for very sloppy code - for...

python,matplotlib,mplot3d,contourf

I agree with Ajean. I believe the problem arises because each matplotlib's artist (i.e. PolygonCollection) is rendered separately. There is no way different faces from the same object to be rendered on different sides of another object in the scene. Here is a useful piece of code : from mpl_toolkits.mplot3d...

If I extend a little bit your example to get something I can plot, I do reproduce the problem: [th,r] = meshgrid((0:0.5:360)*pi/180,0:.02:1); [X,Y] = pol2cart(th,r); Z = sqrt( X.^2 + Y.^2 ) ; isoLevel = 0:0.1:10 ; [C ,hc] = contourf(X,Y,Z,isoLevel) ; The black line at the interface is because...

contourf splits your data into n (10 for your case) levels. Unless you specify the levels they are chosen automatically by the function. The highest level must be lower than the highest point in your data. Maybe it could be the same, I'm not sure how matlab treats values equal...

python,matplotlib,smooth,contourf

Answering the first question: You can smooth the contour values doing: zmin = Z1.min() zmax=Z1.max() levels=linspace(zmin, zmax, 400) and then pass levels as an argument to plt.contourf(). To smooth the outer edges you have to use more values in your 2-D grid, which can be achieved passing the number of...