Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在matplotlib中使轴刻度变大_Python_Matplotlib_Graph_Axis - Fatal编程技术网

Python 如何在matplotlib中使轴刻度变大

Python 如何在matplotlib中使轴刻度变大,python,matplotlib,graph,axis,Python,Matplotlib,Graph,Axis,我目前正在开发一个用于绘制数据的程序,我需要一种方法使轴上的数字记号变大,轴变粗。有办法做到这一点吗?我试着到处找,但上面什么也找不到。我将PyQt5与Spyder一起使用,Tick和axis参数的分配方式不同 要访问轴线,可以使用ax.spines[ 要设置刻度参数,可以使用ax.tick_params并指定要应用参数的轴和刻度类型,否则,通过ax.xaxis或ax.yaxis访问单轴 import matplotlib.pyplot as plt fig = plt.figure() ax

我目前正在开发一个用于绘制数据的程序,我需要一种方法使轴上的数字记号变大,轴变粗。有办法做到这一点吗?我试着到处找,但上面什么也找不到。我将PyQt5与Spyder一起使用,Tick和axis参数的分配方式不同

要访问轴线,可以使用
ax.spines[

要设置刻度参数,可以使用
ax.tick_params
并指定要应用参数的轴和刻度类型,否则,通过
ax.xaxis
ax.yaxis
访问单轴

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

# set the axis line width in pixels
for axis in 'left', 'bottom':
  ax.spines[axis].set_linewidth(2.5)

# set the parameters for both axis: label size in font points, the line tick line 
# width and length in pixels
ax.tick_params(axis='both', which='major', labelsize=20, width=2.5, length=10)

# alternatively, set for individual axis:
#ax.xaxis.set_tick_params(which='major', labelsize=20, width=2.5, length=10)
#ax.yaxis.set_tick_params(which='major', labelsize=20, width=2.5, length=10)

plt.show()

欢迎使用StackOverflow!如果您清楚地解释您的问题,并演示您在自己的搜索中尝试了什么或发现了什么,那么问题被接受的几率会更高。在您的情况下,我认为解释和显示您正在绘制什么/如何绘制的演示代码会很有帮助,例如使用matplotlib的r u?如果是,您有什么经验试过了吗?有很多文档。这能回答你的问题吗?