Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plot two figures in one line in ipython notebook

I just use the inline in ipython to plot figures

%matplotlib inline

However, since I want to plot thousands of figures in the notebook and compare each two figures at the same time, but ipython just give me this two figure, one is under the other.

I just want to know, how can I put this two pictures in a row. That is one in the right of the other?

And, subplot will not become my choice, because I just use functions in a package to plot this two figure.

ee.daily_plot(2)
ee.hourly_plot(2)
like image 726
Zhiwei Liu Avatar asked Apr 14 '26 04:04

Zhiwei Liu


1 Answers

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(10)
y = np.arange(10)
z = np.arange(10)**2

nrows = 1
ncols = 2
fig = plt.figure(figsize=(10, 5))

ax = fig.add_subplot(nrows, ncols, 1)
ax.plot(x, y)

ax = fig.add_subplot(nrows, ncols, 2)
ax.plot(x, z)
like image 138
lightalchemist Avatar answered Apr 17 '26 04:04

lightalchemist



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!