I have three datasets (data1, data2, data3), and I'd like to create a rather complicated plot: a stacked scatter plot (two scatter plots that on top of each other) with three histograms on sides.
This is what I have so far for one set, and below you can see the resulting plot:
from numpy.random import randn
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
data1 = randn(500)
data2 = randn(500) * 20
data3 = randn(500) + 5
e1c = sns.color_palette()[0]
e2c = sns.color_palette()[1]
e3c = sns.color_palette()[2]
with sns.axes_style("white"):
g = sns.JointGrid(data2, data3)
g.plot_marginals(sns.distplot, kde=False, color=e3c)
g.plot_joint(plt.scatter, color=e3c, alpha=.2)
plt.show()
And now the same one with the annotations what I exactly need to produce:
To make it more complicated, the left and right y axes (data1 and data 3) have a different range of values.
So to summarise, here are the list of things I need to include:
- Another scatter plot (data2, data1) in color e1c
- data1 has to have a histogram on the left, in color e1c
- All histograms should have finer bins (say, 5x more bins).
- Histogram on top (data2) should be in color e2c.
- There should be two y axis (one for data1, another for data3).
- There should be labels on each axis ("Data 1", ...).
How to accomplish this?