[Matplotlib-users] Reverse y-axis?
Hi I need to plot some data vs depth. In stead of giving depths as 0,-1000,-2000, I want to give the depths as 0,1000,2000 but when plotting the data goes downwards (as if they had been negative). Can I get the y-axis to reverse so it goes downwards and not upwards? -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Reverse y-axis?
On 06/25/2010 07:41 AM, Preben Randhol wrote: Hi I need to plot some data vs depth. In stead of giving depths as 0,-1000,-2000, I want to give the depths as 0,1000,2000 but when plotting the data goes downwards (as if they had been negative). Can I get the y-axis to reverse so it goes downwards and not upwards? If using the OO interface: axes.invert_yaxis() or axes.set_ylim(2000, 0) # note the larger value first or with the pylab interface: ylim(2000, 0) Mike -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Reverse y-axis?
There's no single function to do it, but just reversing the current ylimits manually is a one-liner. (plt is matplotlib.pyplot, here) plt.ylim(plt.ylim()[::-1]) Hope that helps, -Joe On Fri, Jun 25, 2010 at 6:41 AM, Preben Randhol rand...@pvv.org wrote: Hi I need to plot some data vs depth. In stead of giving depths as 0,-1000,-2000, I want to give the depths as 0,1000,2000 but when plotting the data goes downwards (as if they had been negative). Can I get the y-axis to reverse so it goes downwards and not upwards? -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users