ipython notebook arrange plots horizontally

前端 未结 4 497
谎友^
谎友^ 2021-02-02 13:11

Currently, when creating two consecutive plots in an ipython notebook, they are displayed one below the other:

\"ent

4条回答
  •  迷失自我
    2021-02-02 14:01

    Yes, you can do this:

    In [3]: import numpy as np
       ...: xs = np.linspace(0,100,100)
       ...: fig, axs = plt.subplots(nrows=1, ncols=2)
       ...: axs[0].plot(xs, xs * xs)
       ...: axs[1].plot(xs, np.sqrt(xs))
       ...: 
    

    Output:

    enter image description here

提交回复
热议问题