1
在Matplotlib中,我想使用y轴的FunctionFormatter格式化坐标图,以便在靠近图底部的区域不显示任何刻度。这是制作一个“无数据”区域,即沿着图底部的一条带,其中没有y值的数据将被绘制。Matplotlib:使用显示坐标的自定义坐标轴格式化程序
伪代码,该功能会是这样:
def CustomFormatter(self,y,i):
if y falls in the bottom 50 pixels' worth of height of this plot:
return ''
或
def CustomFormatter(self,y,i):
if y falls in the bottom 10% of the height of this plot in display coordinates:
return ''
我敢肯定,我必须使用倒axes.transData.transform要做到这一点,但我不确定如何去做。
如果很重要,我还会提到:在这个格式化程序中我也会有其他格式化规则,处理确实有有y个数据的那部分。