Re: [Matplotlib-users] changing tick labels and tick positioning to account for origin From: Matthias Michler - 2009-07-28 14:06 ```Hi, as nobody answered up to now I may make my (tiny) contribution. On Friday 24 July 2009 22:58:10 per freem wrote: > Hi all, > > i have a simple scatter plot, where the x axis and y axis are on different > scales starting from 0. the x axis here ranges from 0 to 300 and the y axis > from 0 to 1. i plot it as follows: > > my_fig = plt.figure(figsize=(6,5), dpi=100) > x = rand(100)*300 > y = rand(100) > plt.scatter(x, y) > plt.rcParams['xtick.direction'] = 'out' > plt.rcParams['ytick.direction'] = 'out' > plt.xlim([-0.05, 300.05]) > plt.ylim([-0.05, 1.05]) > plt.show() > > i'd like to leave a bit of space between the origin and the x-axis 0 and > between the origin and y-axis 0, which is why i added 0.05 to the end > points of each axis. however, i'd like the space between 0 and the origin > on either axis to be the same. since 0.05 on a scale from 0 to 300 is not > the same amount of space as 0.05 on a scale from 0 to 1, this is not the > effect i get. the yaxis looks good but the xaxis does not. how can i fix > this? plt.xlim([-0.05*300, 300*1.05]) plt.ylim([-0.05, 1.05]) > second, how can i remove the upper x axis ticks and the right y axis ticks? > these ticks are really not informative to the plot. ideally i would like to > remove those axes altogether, and just have one x axis and one y axis -- > but i don't want to manually plot the axes. is there a way to do this? > > if that is not possible i'd like to at least remove those tick marks from > the duplicate axes. any thoughts on this will be greatly appreciated. Unfortunately I have no idea about this. Maybe someone else has an idea, if it is possible to remove the upper / right ticks. best regards Matthias ```
 Re: [Matplotlib-users] changing tick labels and tick positioning to account for origin From: Matthias Michler - 2009-07-28 14:06 ```Hi, as nobody answered up to now I may make my (tiny) contribution. On Friday 24 July 2009 22:58:10 per freem wrote: > Hi all, > > i have a simple scatter plot, where the x axis and y axis are on different > scales starting from 0. the x axis here ranges from 0 to 300 and the y axis > from 0 to 1. i plot it as follows: > > my_fig = plt.figure(figsize=(6,5), dpi=100) > x = rand(100)*300 > y = rand(100) > plt.scatter(x, y) > plt.rcParams['xtick.direction'] = 'out' > plt.rcParams['ytick.direction'] = 'out' > plt.xlim([-0.05, 300.05]) > plt.ylim([-0.05, 1.05]) > plt.show() > > i'd like to leave a bit of space between the origin and the x-axis 0 and > between the origin and y-axis 0, which is why i added 0.05 to the end > points of each axis. however, i'd like the space between 0 and the origin > on either axis to be the same. since 0.05 on a scale from 0 to 300 is not > the same amount of space as 0.05 on a scale from 0 to 1, this is not the > effect i get. the yaxis looks good but the xaxis does not. how can i fix > this? plt.xlim([-0.05*300, 300*1.05]) plt.ylim([-0.05, 1.05]) > second, how can i remove the upper x axis ticks and the right y axis ticks? > these ticks are really not informative to the plot. ideally i would like to > remove those axes altogether, and just have one x axis and one y axis -- > but i don't want to manually plot the axes. is there a way to do this? > > if that is not possible i'd like to at least remove those tick marks from > the duplicate axes. any thoughts on this will be greatly appreciated. Unfortunately I have no idea about this. Maybe someone else has an idea, if it is possible to remove the upper / right ticks. best regards Matthias ```