0
我用Python繪製了一些數據,並試圖用FuncFormatter
來改變刻度。現在我想將分割改爲圓形數字。我也希望在同一陣型中有較小的蜱蟲,在我的情況下,這將是一個1/x
細分。我希望擴大規模。圖片將幫助你想象我的問題。python 1/x繪圖刻度格式化,刻度位置
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as tick
x = np.array([805.92055,978.82006,564.88627,813.70311,605.73361,263.27184,169.40317])
y = np.array([10,9,8,7,6,3,2])
fig, ax = plt.subplots(figsize =(3.6,2.5))
plt.plot(1/x,y,linestyle ='None',marker='1')
a=0.001
b=0.005
plt.xlim(a,b)
def my_formatter_fun(x, p):
return "%.0f" % (1/x)
ax.get_xaxis().set_major_formatter(tick.FuncFormatter(my_formatter_fun))
我怎樣才能改變segmentaion讓我得到這樣的事情?我認爲可以通過my_formatter_fun
添加我的願望,但我不知道如何。我怎樣才能在1/x
分佈中添加次要蜱?我試過plt.minorticks_on()
,但這不起作用,因爲它們處於線性位置。