ely66
ely66

Reputation: 185

Show plots side by side

I have functions that produces plots,

And i used it three time with different values to give me three plots.

My question is that i want to put the plots side by side horizontally to be able to compare them. As doing the following show every plot after the other vertically.

make_plot(twiss)
make_plot(twiss_error)
make_plot(twiss_corrected)

Upvotes: 1

Views: 1279

Answers (1)

fdsig
fdsig

Reputation: 315

If you are using matplotlib perhaps use subplots:

https://matplotlib.org/3.5.0/api/_as_gen/matplotlib.pyplot.subplots.html

import matplotlib.pyplot as plt
fig, ax = plt.subplots (1,2)

enter image description here

you can access subplots by index as in

 ax[0]

in your code.

Hope that this helps.

Upvotes: 1

Related Questions