Modify tick label text

前端 未结 10 1489
遥遥无期
遥遥无期 2020-11-22 07:13

I want to make some modifications to a few selected tick labels in a plot.

For example, if I do:

label = axes.yaxis.get_major_ticks()[2].label
label         


        
10条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 08:20

    This works:

    import matplotlib.pyplot as plt
    
    fig, ax1 = plt.subplots(1,1)
    
    x1 = [0,1,2,3]
    squad = ['Fultz','Embiid','Dario','Simmons']
    
    ax1.set_xticks(x1)
    ax1.set_xticklabels(squad, minor=False, rotation=45)
    

提交回复
热议问题