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個數據的那部分。