Scale plot size of Matplotlib Plots in Jupyter Notebooks

后端 未结 1 1393
北恋
北恋 2021-02-05 18:43

Is there a possibility to scale the plot size of matplotlib plots in jupyter notebooks? You could increase the plot size by changing the default values of figure.figsize

1条回答
  •  [愿得一人]
    2021-02-05 19:26

    You don't want to change the figure size. You want to change the dpi (dots per inch).
    Also see Relationship between dpi and figure size.

    import matplotlib.pyplot as plt
    %matplotlib inline
    
    def plot(dpi):
        fig, ax=plt.subplots(dpi=dpi)
        ax.plot([2,4,1,5], label="Label")
        ax.legend()
    
    for i in range(1,4):
        plot(i*72)
    

    0 讨论(0)
提交回复
热议问题