python - change X ticks in matplotlib plot -


i plotted graph in matplotlib, , looks : graph

on x-axis values [50,100,150,200,250]. want change them [10,20,30,40,50]. without changing or touching graph. dont want use plt.xlim() because changes part of displaying graph. how can this?

my plotting code:

def plot_random_angular():     m = np.loadtxt('angle.txt')     uhol = m[:,6]     vys = []     x in xrange(1,len(uhol)):         vys.append((uhol[x] - uhol[x-1])*4)     x=np.linspace(0,len(vys),len(vys))     plt.ylim(-5,5)     plt.xlim(0,250)     plt.grid()     plt.xlabel('time [s]',fontsize = 18)     plt.ylabel('angle [deg]',fontsize = 18)     plt.plot(x,vys,'black')     return vys 

make 1/5 of original?:

ax=plt.gca()  #ax.get_xticks() current ticks ax.set_xticklabels(map(str, ax.get_xticks()/5.0)) 

Comments

Popular posts from this blog

c# - must be a non-abstract type with a public parameterless constructor in redis -

c# - ReportViewer control - axd url -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -