main

2022/02/11

matplotlib plot settings

method 1 

import matplotlib

matplotlib.rc('xtick', labelsize=20)

matplotlib.rc('ytick', labelsize=20)

matplotlib.rc('font',family='sans-serif', size=12)


 

method 2

import matplotlib.pyplot as plt

 

SMALL_SIZE = 8

MEDIUM_SIZE = 10

BIGGER_SIZE = 12

 

plt.rc('font', size=SMALL_SIZE)          # controls default text sizes

plt.rc('axes', titlesize=SMALL_SIZE)     # fontsize of the axes title

plt.rc('axes', labelsize=MEDIUM_SIZE)    # fontsize of the x and y labels

plt.rc('xtick', labelsize=SMALL_SIZE)    # fontsize of the tick labels

plt.rc('ytick', labelsize=SMALL_SIZE)    # fontsize of the tick labels

plt.rc('legend', fontsize=SMALL_SIZE)    # legend fontsize

plt.rc('figure', titlesize=BIGGER_SIZE)  # fontsize of the figure title

 

method 3

matplotlib.rc('xtick', labelsize=20)

matplotlib.rc('ytick', labelsize=20)

matplotlib.rc('font', size=20)

matplotlib.rc('axes', titlesize=20)

matplotlib.rc('axes', labelsize=20)

matplotlib.rc('legend', fontsize=20)

matplotlib.rc('figure', titlesize=20)

 


method 4

#size=25

size=15

params = {'legend.fontsize': 'large',

          'figure.figsize': (20,8),

          'axes.labelsize': size,

          'axes.titlesize': size,

          'xtick.labelsize': size*0.75,

          'ytick.labelsize': size*0.75,

          'axes.titlepad': 25}

plt.rcParams.update(params)

 

No comments:

Post a Comment

How to Supercharge Your Python Classes with Class Methods

  How to Supercharge Your Python Classes with Class Methods | by Siavash Yasini | May, 2024 | Towards Data Science As we just mentioned, a c...