0

I want to plot multiple graphs for Dataframes and box plots side by side instead of top to bottom. For example, If i plot these 3 graphs in will appear top to bottom.I want to display it sides by side(left to right)

df.plot(x="Date", y=["Temp.PM", "Temp.AM"],subplots=True )
df.plot(x="Date", y=["pH_AM", "pH_PM"])
df.plot(x="Date", y=["WindSpeed_AM", "WindSpeed_PM"])

enter image description here Rather than appearing this way.

petezurich
  • 9,280
  • 9
  • 43
  • 57
johnson
  • 379
  • 2
  • 17

1 Answers1

1

The following serves as an example. There are of course many parameters that can be set and changed:

import numpy as np
import matplotlib.pyplot as plt

Some example data:

x1 = np.random.rand(10) * 10
x2 = np.random.rand(10) * 20
x3 = np.random.rand(10) * 30

Creating the subplots:

fig, axes = plt.subplots(1, 3)
axes[0].boxplot(x1)
axes[1].boxplot(x2)
axes[2].boxplot(x3)
fig.tight_layout()
plt.show()

enter image description here

Of course, different type of plots (boxplots, lineplots etc) can be combined.

Ruthger Righart
  • 4,799
  • 2
  • 28
  • 33