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()
,但这不起作用,因为它们处于线性位置。