importmatplotlib.pyplotaspltimportnumpyasnp# 创建数据x=np.linspace(0,7,8)y=x**2# 创建图表plt.figure(figsize=(10,6))plt.plot(x,y,'o-')# 设置刻度位置和标签days=['Mon','Tue','Wed','Thu','Fri','Sat','Sun','Next Mon']plt.gca().xaxis.set_ticks(x)plt.gca().xaxis...
第一个是设置坐标轴的范围,第二个是设置精度及精度的范围: 程序: importmatplotlib.pyplot as pltimportnumpy as np ax=plt.gca() ax.set_xlim(-10,10) ax.set_ylim(-10,10)#网格plt.grid(linestyle='-.')#linestyle = lsmy_x1= np.arange(-5,5,0.5) plt.xticks(my_x1) plt.show() 结果:...
(of the same size) the values of the pixels in the unit I want for x and y, but I do not see how to combine these matrices with my figure. When I reduced the matrix to a vector of 2048x1 and I use set(gca,'XTickLabel', X), the values I got are not the good one. Do ...