471,348 Members | 1,195 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

Matlab axis control problem - solved

I don't understand my earlier problem but the following code works no
matter what the ylim is set to:

I reworked the example major_minor_demo1.py to find the answer.

thanks
Dick C

ps: I still can't post a reply since I read the list with my mozilla or
konqueror browser and email separately with thunderbird - the reply
address is not obvious.

from pylab import *
from matplotlib.ticker import MaxNLocator, MultipleLocator,
FormatStrFormatter

x=[10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0]
y=x
figure(1)
ax=subplot(111)
ax.plot(array(x), array(y), 'x')

ymajorLocator = MultipleLocator(5)
ymajorFormatter = FormatStrFormatter('%d')

ax.set_yscale('log')

ax.set_ylim(18.0, 58.0)

ax.yaxis.set_major_locator(ymajorLocator)
ax.yaxis.set_major_formatter(ymajorFormatter)

ax.yaxis.grid(True, linestyle='-', which='major')
show()

Oct 17 '07 #1
0 1079

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by John Hunter | last post: by
6 posts views Thread by Lars Christiansen | last post: by
9 posts views Thread by Carl | last post: by
2 posts views Thread by Binod Pant | last post: by
3 posts views Thread by Jeremy Chapman | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.