一、python 源码如下
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
#x=[0 ,1,2,3,5,6,10]
#y=[0,0,3,4,5,7,8]
# { 0 , 1 , 0x0003 },// 0
# { 0XFFFF * 1 / 10 , 3006 , 0x0a6b },// 1
# { 0XFFFF * 2 / 10 , 5997 , 0x14c5 },// 2
# { 0XFFFF * 3 / 10 , 8992 , 0x1f22 },// 3
# { 0XFFFF * 4 / 10 , 11991 , 0x2983 },// 4
# { 0XFFFF * 5 / 10 , 14988 , 0x33e3 },// 5
# { 0XFFFF * 6 / 10 , 17986 , 0x3e42 },// 6
# { 0XFFFF * 7 / 10 , 20983 , 0x48a2 },// 7
# { 0XFFFF * 8 / 10 , 23980 , 0x5302 },// 8
# { 0XFFFF * 9 / 10 , 26978 , 0x5d61 },// 9
# { 0XF300 , 28453
x=[0,0XFFFF * 1 / 10,0XFFFF * 2 / 10,0XFFFF * 3/ 10,0XFFFF * 4/ 10,0XFFFF * 5/ 10,0XFFFF * 6/ 10,0XFFFF * 7/ 10,0XFFFF * 8/ 10,0XFFFF * 9 / 10,0XF300]
#y=[1,3006,5997,8992,11991,14988,17986,20983,23980,26978,28453]
y=[1,3006,5997,8992,11991,14988,17986,20983,23980,26978,28453]
c=[0,0XF300]
d=[1,28453]
mpl.rcParams['figure.facecolor'] = 'silver'
plt.rcParams['axes.facecolor'] = 'silver'
ax = plt.gca()
#去掉边框
#ax.spines['top'].set_color('none')
#ax.spines['right'].set_color('none')
#移位置 设为原点相交
ax.xaxis.set_ticks_position('bottom')
ax.spines['bottom'].set_position(('data',0))
ax.yaxis.set_ticks_position('left')
ax.spines['left'].set_position(('data',0))
plt.title('Title')
plt.plot(c, d, linewidth = 1.0,color='red', label='test2')
plt.plot(x, y,linewidth = 1.0, color='blue', label='test1')
plt.plot(x, y, 'om')
plt.legend() # 显示图例
plt.xticks(range(0, 0XF300, 5000))
plt.xticks(rotation = 90)
plt.yticks(range(0, 30000, 5000))
plt.axis('equal')
plt.xlabel('X')
plt.ylabel('Y')
#plt.savefig("C:/Users/Watson/Desktop/test.jpg")
plt.show()
二、效果图如下
三、参考文章
python绘制直方图横坐标标签竖直显示的方法_python画直方图设置横坐标_我的眼中满是星辰的博客-CSDN博客
plt.axis()用法详解_那一勺甜的博客-CSDN博客
python plt画图横纵坐标0点重合_TravelingLight77的博客-CSDN博客
Python matplotlib绘制图形实例(包括点,曲线,注释和箭头)_python_脚本之家
https://www.cnblogs.com/super-zhang-828/articles/4792206.html
python matplotlib 画图神器-腾讯云开发者社区-腾讯云
解决matplotlib绘图x轴和y轴不在零点相交问题_plt设置x轴在y的0上_爱吃柚子的梨的博客-CSDN博客