I have a big function which output is a dataframe and 2 charts. Something like this:
summary = pd.concat([mean, std], axis=1)
chart1 = sns.tsplot(sample['x'].cumsum())
chart2 = sns.tsplot(summary['mean'])
result = [summary, chart1, chart2]
return result
Everything works fine, except, I only get one chart with the two time series in it. I would like to get two separate charts. How do I do this?
Thanks
In Seaborn, we will plot multiple graphs in a single window in two ways. First with the help of Facetgrid() function and other by implicit with the help of matplotlib. data: Tidy dataframe where each column is a variable and each row is an observation.
How to plot two Seaborn lmplots side-by-side (Matplotlib)? To create two graphs, we can use nrows=1, ncols=2 with figure size (7, 7). Create a data frame with keys, col1 and col2, using Pandas. Use countplot() to show the counts of observations in each categorical bin using bars.
Feed explicit matplotlib objects to tsplot
:
import matplotlib.pyplot as plt
import seaborn as sns
def whatever(mean, std, *args, **kwargs):
summary = pd.concat([mean, std], axis=1)
chart1, ax1 = plt.subplots()
sns.tsplot(sample['x'].cumsum(), ax=ax1)
chart2, ax2 = plt.subplots()
sns.tsplot(summary['mean'], ax=ax2)
result = [summary, chart1, chart2]
return result
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With