Skip to content

Tag: matplotlib

obtaining a single plot of two contour lines matplotlib

I am making a program that interpolates the points of some level curves, but when it comes to graphing, I am obtaining two individual graphs of the two level curves and not a single graph. I would like to get this output: Answer You need to declare plt.figure() only once, outside of the for loop. Inside the f…

Matplotlib – Delete lines from a 3d quiver plot

I would like to graphically represent the time trend of a three-dimensional reference frame using Matplotlib and the quiver function. In an event, I simulated the data representing the reference frame through the definition of a 3×3 rotation matrix. Each time the event occurs, it should delete the previo…

How to extend the color palette in matplotlib?

I coded the following function: And then the for-loop: As the for loop iterates over num_columns which has 40 variables, the standard palette only offers 10 colors. However, I want to have every variable its own color. Is there a way to code it also being flexible when it comes to the number of variables? Ans…

Matplotlib stacked histogram label

Here is my picture. I need to make label for those bars however every upper layer contains lower layer – so the label should containt grouped colors, i.e. blue – dataset 1, blue/orange – dataset 2, blue/orange/green – dataset 3 and finally blue/orange/green/purple – dataset 4. Is…