Matplotlib axis control problem
I would like to control the y axis of a plot. The following code does exactly what I want it to! On my linux computer it sets the y axis limits to 18.0 minimum, 58.0 maximum, plots some points on y=x, provides ticks at 20,30,40,50 and horizontal tick lines that intersect the plotted points. All very good, but if I change the upper y axis limit to 54.0, (ax.set_ylim(18.0, 54.0)), it fails, plotting the ticks at some strange values. Ultimately I want to uncomment the set scale to log and use this to label semi log plots that by default are only labeled on powers of 10. My data falls within one decade so I don't want the full 10-100 limits. I'm rather new at matplotlib so if I'm making trivial errors please feel free to criticize. Thanks Dick C from pylab import * from matplotlib.ticker import MaxNLocator 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') #ax.set_yscale('log') ax.set_ylim(18.0, 58.0) ax.yaxis.set_major_locator(MaxNLocator(5)) ax.set_yticklabels(('10', '20','30','40','50','60','70','80','90','100')) ax.yaxis.grid(True, linestyle='-', which='major') show() -- http://mail.python.org/mailman/listinfo/python-list
why doesn't have this list a "reply-to" ?
It seems to me the original question was how can I reply to a posted message. I'm new here and see that while there are replies to several messages, many times, like with this note, the issue is brought up as if it is new. I don't know how to do a reply, can someone tell me how? This note was sent to: python-list@python.org with the subject copied from an earlier note. No need to discuss the politics of the choice. Dick C -- http://mail.python.org/mailman/listinfo/python-list
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() -- http://mail.python.org/mailman/listinfo/python-list