How to draw a coordinate map containing both horizontal and vertical boxplot with matplotlib - python-3.x

I want to draw a picture like this using matplotlib.
How to do that?
Thank you in advance.
Example/i.stack.imgur.com/Vk57A.png

seaborn.jointplot might be what you're looking for. Specify to draw boxplots in the marginal plot and a regplot in the "main plot".
Seaborn builds on top of matplotlib, so you can still modify linecolors, markercolors etc. and draw annotations with plt.annotate.

Related

Why the scatter plot is not showing inside pairplot

sns.pairplot(advertising, x_vars=['TV', 'Newspaper', 'Radio'], y_vars='Sales',size=4, aspect=1, kind='scatter')
plt.show()
here when i am calling the pairplot function it is not showing the first plot, if you change the sequence of x_vars then again it wont show the first plot.
But you can see it individually, How can i see all of them in a single pairplot.
This is a bug/feature introduced in seaborn v.0.11.0.
The workaround it to pass diag_kind=None to pairplot

is it possible to display figures on a graph with matplotlib?

Is there a function in Matplotlib to display black rectangles on a graphic ?, like this :
You might want to look into Matplotlib's Patches and subsequent Rectangle modulus. Here's an example showcasing box creations with some error bars.

gmtset BASEMAP_FRAME_RGB transparency

I want to not have my basemap axes visible for an image I'm making in GMT with several plots in it. So far I have made them white using:
gmtset BASEMAP_FRAME_RGB = white
However some of the plots partially overlap and the white axes can be seen over the plots - any ideas on how to fix this? By making the basemap frame transparent ideally.
In fact I've realised I can change the order I do the plots in so that the overlap doesn't matter - also replaced -B... with -G255 to plot on a blank square.

matplotlib's axvspan converts marker colors in scatter plot but not in ordinary plot

I recently noticed the following phenomen in matplotlib (using v1.3.1 with Python3.3):
Minimal code example
import matplotlib.pyplot as plt
plt.plot(range(5),5*[3],'o', color="r", label="plt.plot")
plt.scatter(range(5),5*[2], color="r", label='plt.scatter')
plt.axvspan(1.5,4.5, color='yellow', alpha=0.5)
ax=plt.gca()
ax.legend(loc=6)
plt.savefig('adjusted_colors.png')
yields a plot with partially adjusted marker colors -- sorry for being not able to show the plot here -- namely markers plotted using pyplot's scatter-function in the area spanned by axvspan.
In contrast, color of markers plotted via pyplot's plot-function is not converted.
Any ideas about how to avoid marker color's adjustment in case plt.scatter is used for plotting, respectively, how to turn it on in case of using plt.plot?
The reason the "colors are adjusted" is not because the color actually changes, but because the scatter result (which is a PathCollection object) is being viewed through a half-transparent colored rectangle that it is underneath. The same doesn't happen to the result of plot (which is a Line2D object) because it lies above the rectangle.
Matplotlib uses an attribute called zorder when it displays artists in a figure (most everything that lives in a matplotlib plot is an artist). The defaults set the plot's zorder to 2, whereas the rectangle and the scatter both have a zorder of 1, and the rectangle defaults to existing "higher" (not sure exactly why, but it is what it is). You can force the scatter points to lie above the rectangle by specifying the zorder keyword:
plt.scatter(range(5),5*[2], color="r", label='plt.scatter', zorder=2)
Or, if you want the opposite, do the same to move the plot points below the rectangle:
plt.plot(range(5),5*[3],'o', color="r", label="plt.plot", zorder=0)

Alternative to flot where the axes labels are within the canvas

I have been using the fantastic canvas plotting library flot. The selection of graph types is excellent but I want to be able to export the whole graph to an image, including axes numbers, ticks and labels and a the graph title.
Unfortunately only the graph itself seems to be drawn in the canvas, the axes numbers and ticks are in divs. Therefore the canvas toDataURL method does not capture everything.
Can anyone recommend a library with similar functionality which either:
Draws everything within the canvas, or
Has a reliable export to image method
In particular I would like a library which supports the percentiles plot.
Flot 0.8 supports drawing axis labels to canvas using the canvas plugin. I don't know about the chart title - that depends on what plugin or code you're using to do that - but it would be relatively easy to add a draw hook to render that text to canvas.
The only thing Flot can't currently draw to canvas is the legend; that will be added in the next release.

Resources