Matplotlib Graphics Chart Size on Jupyter Laptops

Is it possible to scale the size of the matplotlib graphs in jupyter laptops? You can increase the size of the graph by changing the default values figure.figsize, but this does not affect parameters such as fontsize, linewidth, markersize, etc. I need a graph in which all parameters are scaled accordingly.

PS: I use jupyter laptops to display graphs %matplotlib inline, see screenshot below.

Image

Edit

For completeness, here is a snippet of code that does exactly what I need:

def scale_plot_size(factor=1.5):
    import matplotlib as mpl
    default_dpi = mpl.rcParamsDefault['figure.dpi']
    mpl.rcParams['figure.dpi'] = default_dpi*factor
+4
source share
1 answer

. dpi ( ).
. dpi .

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)

enter image description here

+4

Source: https://habr.com/ru/post/1679979/


All Articles