How to change separation between tick labels and axis labels in Matplotlib

后端 未结 2 1763
旧巷少年郎
旧巷少年郎 2020-12-31 12:17

My axis labels often look not good (too close to tick labels) when I use Matplotlib.

\"test

How

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-31 12:48

    To move the axis label further away from the axis, you can include an argument to the optional labelpad parameter of the corresponding method used to set the label, i.e. ax.set_ylabel() or ax.set_xlabel(). This parameter takes a scalar which is the spacing between the axis and the label given in points.

    As to achieve the same effect when using the drawparallels() method of Basemap, I believe you can include an argument to the parameters xoffset or yoffset, depending on which axis you want to alter the placement of the text. The arguments of these parameters have "units" of map width, meaning e.g. xoffset=0.05 makes the offset of the x-ticks 5 % of the map width.

提交回复
热议问题