我有一个计算的结果,我正试图用一个个性化的x轴来绘制它
import numpy as np
import math
import matplotlib.pyplot as plt
maxPar = 100
minPar = 6
step = 1
parameterList = np.arange(minPar, maxPar, step)
footprint = np.ones(parameterList.size)
for parameter in parameterList:
pl = 20*math.log10(parameter) + 28.0 + 22*math.log10(math.sqrt(200**2 + math.fabs(8.5)**2))
footprint[ np.where(parameterList == parameter)[0][0] ] = 30+25+2.15 - pl
plt.plot(parameterList, footprint)
plt.xticks(np.arange(min(parameterList), max(parameterList), 4.0))
plt.margins(0, x=True)
plt.show()
我的目标是有一个10-20-30-…-90-100的x轴,但我希望在开始时有6。如果不可能的话,我至少希望在情节的开头有6个,结尾有100个
检查此解决方案
输出:
您可以在此处了解有关matplotlib用法的更多信息, https://matplotlib.org/api/pyplot_api.html
根据评论中的问题进行更新:
输出:
相关问题 更多 >
编程相关推荐