I am trying to plot the top 30 percent values in a data frame using a seaborn scatter plot as shown below. The reproducible code for the same plot: Here, I want sort the x-axis in order = [‘virginica’,’setosa’,’versicolor’]. When I tried to use order as one of the parameter in sns.scatterplot(), it returned an error AttributeError: ‘PathCollection’ object has
Tag: matplotlib
Reproducing a 2d histogram in Python
I’m working with a very large dataset in Python, so I’m trying to use histograms instead of arrays (the arrays get way too large for saving/loading/mapping). I’m crawling over a bunch of files and pulling information from them, and I would like to then take the information and remake the histograms afterwards. I can do this with a 1D histogram
How subplot pairs of photo from different folder
I have 2 folder each has 13 pics. I wanna plot any pair of them. for example the first pic from the first folder next to the first pic in the second folder. and then below it the second pair of photose from the first and second folder. could you please help me. I tried my self but id doesn’t
Plot a Dictionary of Dataframes
I have a dictionary of dataframes (Di): For each df in Di, I would like to plot A against B in a single graph. I tried: But that gave me two graphs: How do I get them both in the same graph please? Answer You should print on a same ax:
The saved animated plot keeps looping although Matplotlib FuncAnimation(…,repeat=False)
I’d like to make an animation using matplotlib for a powerpoint presentation. The animation should only play once. In my code, the argument repeat of FuncAnimation() was set to false. Because I need to import the figure into powerpoint, I saved it using ani.save(‘test.gif’). The problem is when I open the saved figure which is test.gif, the lineplot keeps looping.
Python, Error while installing matplotlib
OS: Windows 10 Python ver: 3.9.0 Error code: I tried: didn’t work. and then I tried: didn’t solve the problem. I read on SO that maybe if I open the shell in administrator mode it could solve the problem but it didn’t work too. I saw someone mentioning ez-setup for this error code. I installed it but that didn’t work
Matplotlib: I don’t know if I’m plotting in the correct way
When I need to plot 2 series on y axis, I don’t know if this is the best way. It works with lines, but it does not work with line + bars. If I set y2 kind=’bar’, this serie disappears. indexesM is my dataframe. This is the code: Answer I created a composite graph by customizing a sample from the
How to plot figures to different subplot axes in matplotlib
I was trying to plot a figure with a combination of a 3d subplot and 3 2d ones. Why do they overlap each other? Here are my codes: Answer In each group, an ax is created with ax = fig.add_subplot(3, 2, 1, projection=’3d’), but then you reassign the variable with ax = plt.axes(projection=’3d’); this does not plot to ax. To
How to fix ‘numpy.ndarray’ object has no attribute ‘get_figure’ when plotting subplots
I have written the following code to plot 6 pie charts in different subplots, but I get an error. This code works correctly if I use it to plot only 2 charts, but produces an an error for anything more than that. I have 6 categorical variables in my dataset, the names of which are stored in the list cat_cols.
Matplotlib 3d scatter _facecolors3d not working
I am trying to save a 3d scatter plot animation where points appear one at a time. I made the animation work, but when I set the face colors of the points they do not take effect and all points appear blue. When I use the same color array but on static image, colors work well. Animation Code: When I