Home > Net >  Dual y axis matplotlib
Dual y axis matplotlib

Time:01-30

How can I make a figure with 2 charts, and both charts have dual Y axis?

I know have to make dual y axis for a figure with 1 chart, but wasn't able to figure out how to do it for two charts.

This is the syntax I use for matplotlib: fig, ax = plt.subplots()

CodePudding user response:

This should be fairly simple:

fig, ax = plt.subplots(1, 2) # or (2, 1) depending on how you want them aligned
ax[0].plot(...)
ax[1].plot(...)

For the dual y-axis, follow this: Dual y-Axis Plot

  • Related