python使用matplotlib绘图使刻度线向内

python使用matplotlib绘图时使刻度线向内

  • 刻度向外的程序
import numpy as np
import matplotlib.pyplot as plt
num = np.arange(10).reshape(2,5)
##print(num[0])
plt.plot(num[0],num[1])
plt.show()

结果:

1558609315334
在这里插入图片描述

  • 刻度向内的程序
import numpy as np
import matplotlib.pyplot as plt
num = np.arange(10).reshape(2,5)
##print(num[0])
plt.rcParams['xtick.direction'] = 'in'#将x周的刻度线方向设置向内
plt.rcParams['ytick.direction'] = 'in'#将y轴的刻度方向设置向内
plt.plot(num[0],num[1])
plt.show()

结果:
在这里插入图片描述
1558609406803

发布了22 篇原创文章 · 获赞 59 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/weixin_43245453/article/details/90486169
今日推荐