> -----Original Message----- > From: Alex S [mailto:schmitt.happ...@gmail.com] > Hi there, > I'm trying to make a plot with two y axes. I'm able to do that no > problem, > but what I'd really like to do now is make the tick marks line up for > them > both so that they both use the same grid. Is there a simple way to do > this? > Basically, I want to force the number of tick marks on the right hand > axis > to be the same as on the left hand axis, and I'd like it to select "nice > numbers" to do so (ie not intervals of .358 or something).
Hey Alex, I always just figure this out on my own. There might exist a more elegant way though. Starting with this: import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(111) ax2 = ax1.twinx() # plot stuff # So then you could do something like: ytx1 = ax1.get_yticks() ...and then use to len(ytx1) and range() to ax2.set_yticks(blahblah). The tricky part is picking a max for your range() so that your stepsize produces nice numbers. > Also, on a somewhat related note, is there a simple way to force the y > ticks > to start at 0 rather than some other value? ax1.set_ylim(ymin=0) HTH, -paul h. ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users