Re: [Matplotlib-users] horizontal alignment of a secondary y-axis

2015-02-14 Thread Tommy Carstensen
Again I did this padding manually by introducing yet another magic constant. Thank you to you and Erik for your help. After using a lot of hacks and magic constants here are the final plots: http://www.tommycarstensen.com/matplotlib1.png http://www.tommycarstensen.com/matplotlib2.png Notice 1) the

Re: [Matplotlib-users] horizontal alignment of a secondary y-axis

2015-02-14 Thread Ryan Nelson
Tommy, It would be helpful if you included a more complete example that illustrates the problem. If you are setting the text size yourself, couldn't you adjust the padding as such "pad=20/txt_size". Then the padding will be inversely proportional to the size of the text. I suspect this is related

Re: [Matplotlib-users] horizontal alignment of a secondary y-axis

2015-02-14 Thread Tommy Carstensen
Ryan, do you know, if there is any way I can make the padding dependent on the tick label sizes? for label in ax2.yaxis.get_ticklabels(): label.set_horizontalalignment('right') ax2.tick_params(pad=20) When the numbers are large, then they are glued to the secondary y-axis. When they are small,

Re: [Matplotlib-users] horizontal alignment of a secondary y-axis

2015-02-14 Thread Ryan Nelson
You're welcome, Tommy. I used gnuplot many years ago, but I've been much happier now that I know MPL. A gnuplot->MPL Rosetta Stone might be a useful blog post for someone. I haven't used gnuplot in so long that I don't think I could do this myself. R On Sat, Feb 14, 2015 at 12:28 PM, Tommy Carst

Re: [Matplotlib-users] horizontal alignment of a secondary y-axis

2015-02-14 Thread Tommy Carstensen
Whoa, thanks for a great answer Ryan. I can see, why the level of control MPL gives you is a great sales pitch. It's one of the reasons, why I switched from gnuplot after using it for many years and making many cool plots. The MPL learning curve has just been a bit steep, when you are used to plot

Re: [Matplotlib-users] horizontal alignment of a secondary y-axis

2015-02-14 Thread Ryan Nelson
Tommy, I'll try to answer your points in order: 1) Oops. That should have been "xticks". import matplotlib.pyplot as plt plt.plot([1,3,2]) ticks, labels = plt.xticks() plt.xticks(ticks, horizontalalignment='left') plt.show() 2) Sorry for the ambiguity. "OO" is short for object-oriented. There a

Re: [Matplotlib-users] horizontal alignment of a secondary y-axis

2015-02-14 Thread Tommy Carstensen
Hi Ryan, Thanks for your answer. Sorry for not replying sooner. I fell asleep shortly after sending my question. What is "the OO way"? Your 1st solution gives: AttributeError: 'module' object has no attribute 'ticks' I modified your 2nd solution to accommodate my wishes and needs: import matplo

[Matplotlib-users] horizontal alignment of a secondary y-axis

2015-02-13 Thread Tommy Carstensen
How can I set the horizontal alignment of a secondary y-axis to 'right'? Currently the numbers are glued to the axis. I want the axis values to be right aligned integers. Thanks. -- Dive into the World of Parallel Programm