matplotlib ticks thickness

后端 未结 3 877
梦如初夏
梦如初夏 2020-12-03 02:44

Is there a way to increase the thickness and size of ticks in matplotlib without having to write a long piece of code like this:

for line in ax1.yaxis.get_ti         


        
3条回答
  •  不思量自难忘°
    2020-12-03 03:35

    You can change all matplotlib defaults using rcParams like in

    import numpy as np
    import matplotlib as mpl
    import matplotlib.pyplot as plt
    
    # set tick width
    mpl.rcParams['xtick.major.size'] = 20
    mpl.rcParams['xtick.major.width'] = 4
    mpl.rcParams['xtick.minor.size'] = 10
    mpl.rcParams['xtick.minor.width'] = 2
    
    x = np.linspace(0., 10.)
    plt.plot(x, np.sin(x))
    
    plt.show()
    

提交回复
热议问题