Skip to content

Tag: matplotlib

X-axis out of order seaborn histplot

I am trying to create a seaborn histplot and am almost done, however, I noticed that my x-axis is out of order. Displays: Adding order argument as shown here creates the following error(s): How can I force that order on my x-axis? Answer You could create a bar plot, using np.histogram to count how many values…

Python: Plot sin wav with 3 discrete amplitudes

Using the code below I am able to create a sign wave I would like to create a sin wave which changes it’s amplitude at time 4s, and 8s so that the sin wave looks like the image below I know how to create each of the 3 sin waves in that img, but I don’t know how to combine

Insert a matrix in matplolib

I want to import a numpy matrix in a matplotlib plot. Let’s say that I have this matrix: In a scale from 0 to 3 of the x axis, I want to plot the points This is the code I use: and this is the outcome: Yet, if I have to use a large array of let’s say (1000×1000) elements