Labels

Saturday, December 19, 2020

Matplotlib notes

# adjust the tick font size 

ax.tick_params(axis='both', which='minor', labelsize=8)

#set tick to right side

ax.yaxis.tick_right()

# remove space between start and end of the axis
plt.margins(x=0)
ax.margins(x=0)
plt.rcParams['axes.xmargin'] = 0

# remove extra fig for subplot
fig.delaxes(axes[1][2])
axes[1,2].set_axis_off()
axes.flat[-1].set_visible(False)


# better minus symbol
matplotlib.rcParams['axes.unicode_minus'] = False

# fontsize
plt.rcParams['font.size'] = '16'


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

Reference:



No comments:

Post a Comment