Relative Content

Tag Archive for matplotlib

How to plot circles with custom size and gradient

I have two numpy arrays where one should be used to determine the radius of matplotlib.patches.Circle and the other should be used to determine its colour from a diverging colourmap. Positive values in data should be orange and negative values blue.

Match plot size with size of data

I’m trying to plot weather data from a Numpy array (precipitation in this example) in matplot using a filled contour. I am currently having issues with missing data and lines at the edge of data values. I suspect this is related to the figure size and resolution of the plot not matching the source array – I’d like each pixel to represent one point in the array but I’m not sure how to accomplish this.

pyplot.hexbin doesn’t use axis ranges correctly

My hexbin plot won’t center at xC=0, yC=0 even though both axes are symmetric.

I’ve marked the center with green lines. As you can see, it does not match. The center of the last bins on the left are exactly where they are supposed to be, at -1.016*0.5. The center of the last bins on the right aren’t. Same problem for the y-axis. The bottom is correct and the top isn’t.

Set Poly3DCollection color after with a 2D array after creation

I am using plot_surface with a 2D colormap array to the Poly3DCollection.set(color=...) method. I made an interactive plot with the slider but since I’m getting mixed results with ugly commands, I’d like to ask if there is a clearer way of doing this.