gpt4 book ai didi

Python:Matplotlib imshow shift xlabel 数字

转载 作者:行者123 更新时间:2023-11-28 22:26:15 30 4
gpt4 key购买 nike

是否可以移动 x 和 y 轴标签编号,例如 +2?例如,我创建了这张图片,但我希望标签编号以 2 开头:

enter image description here

我的代码是:

jacaardMatrix = 1.662887377173091485e-01    3.432835820895522305e-01    3.568320278503046006e-01
5.065963060686015651e-02 3.160270880361173984e-01 3.374888691006233121e-01
3.093987157034442520e-02 1.802120141342756221e-01 1.748178980228928259e-01


fig2=plt.figure()
plt.title("Radius and FRC Jacaard Values for Scoring System: "+str(i))
plt.xlabel('Radius')
plt.ylabel('FRC Size')
plt.imshow(jacaardMatrix)

最佳答案

您可以使用imshowextent 参数来设置绘图的比例。要将其从 2 扩展到 5,请使用

plt.imshow(jacaardMatrix, extent=[2,5,2,5])

其中前两个数字表示 x 范围,后两个数字表示 y 范围。

关于Python:Matplotlib imshow shift xlabel 数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44960896/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com