[英]Converting Matplotlib axis to log only updates labels and not step spacing
I am trying to scale the space on the vertical axis here so it is spaced logarithmically.我试图在这里缩放垂直轴上的空间,因此它是对数间隔的。
After searching the inte.net the proposed solution was在搜索 inte.net 后,建议的解决方案是
ax.set_zscale('log')
After trying that you can see the result below that only the labels where changed and not the actual spacings.尝试之后,您可以看到下面的结果,只有标签发生了变化,而不是实际的间距。
Before前
After后
Unfortunately, the documentation for set_zscale
says :不幸的是,
set_zscale
的文档说:
The axis scale type to apply.
要应用的轴刻度类型。 3D axes currently only support linear scales;
3D轴目前只支持光栅尺; other scales yield nonsensical results.
其他尺度产生荒谬的结果。
So, the other option is just to take the log of your input z-axis values and label the axis accordingly, eg,因此,另一种选择只是记录您输入的 z 轴值和 label 相应的轴,例如,
import numpy as np
ax.scatter(x, y, np.log10(z))
ax.set_zlabel("log10(GDP Per Capita)")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.