I have a two boxplotes But I want to place them in one graph to compare them. Have you any advice to solve this problem? Thanks! Answer Use return_type=’axes’ to get a1.boxplot to return a matplotlib Axes object. Then pass that axes to the second call to boxplot using ax=ax. This will cause both boxplots to be drawn on the
Tag: matplotlib
Align matplotlib scatter marker left and or right
I am using the matplotlib scatterplot function to create the appearance of handles on vertical lines to delineate certain parts of a graph. However, in order to make them look correct, I need to be able to align the scatter plot marker to the left (for the left line / delineator) and / or right (for the right line /
pyplot combine multiple line labels in legend
I have data that results in multiple lines being plotted, I want to give these lines a single label in my legend. I think this can be better demonstrated using the example below, As you can see at Out[23] the plot resulted in 5 distinct lines. The resulting plot looks like this Is there any way that I can tell
Scientific notation colorbar in matplotlib
I am trying to put a colorbar to my image using matplotlib. The issue comes when I try to force the ticklabels to be written in scientific notation. How can I force the scientific notation (ie, 1×10^0, 2×10^0, …, 1×10^2, and so on) in the ticks of the color bar? Example, let’s create and plot and image with its color
How to format axis number format to thousands with a comma
How can I change the format of the numbers in the x-axis to be like 10,000 instead of 10000? Ideally, I would just like to do something like this: Here is the code: Answer Use , as format specifier: Alternatively you can also use str.format instead of format: With matplotlib.ticker.FuncFormatter:
Display numpy array in a for loop using matplotlib imshow
I have a numpy array whose elements are updated in a for loop: I want to display the array at each iteration, but imshow() doesn’t work, it just displays the image once the loop terminates. ps. I’m using an Ipython notebook I found different things on the web but none of them work on my computer (for example I tried
Setting plot background colour in Seaborn
I am using Seaborn to plot some data in Pandas. I am making some very large plots (factorplots). To see them, I am using some visualisation facilities at my university. I am using a Compound screen made up of 4 by 4 monitors with small (but nonzero) bevel — the gap between the screens. This gap is black. To minimise
Move and resize legends-box in matplotlib
I’m creating plots using Matplotlib that I save as SVG, export to .pdf + .pdf_tex using Inkscape, and include the .pdf_tex-file in a LaTeX document. This means that I can input LaTeX-commands in titles, legends etc., giving an image like this which renders like this when I use it in my LaTeX document. Notice that the font for the numbers
Plot histogram with colors taken from colormap
I want to plot a simple 1D histogram where the bars should follow the color-coding of a given colormap. Here’s an MWE: which outputs this: Instead of the color being green for the entire histogram, I’d like the columns to follow a color-coding given by the colormap defined in cm and the values of the bins. This would mean that
How to have clusters of stacked bars
So here is how my data set looks like : I want to have stacked bar plot for each dataframe but since they have same index, I’d like to have 2 stacked bars per index. I’ve tried to plot both on the same axes : But it overlaps. Then I tried to concat the two dataset first : but here