472,989 Members | 2,992 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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()
Oct 16 '07 #1
0 1490

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Enigma Curry | last post by:
I'm playing around with matplotlib for the first time. I'm trying to make a very simple histogram of values 1-6 and how many times they occur in a sequence. However, after about an hour of...
2
by: Caleb Hattingh | last post by:
Hi I tried several Google searches to no avail. I read through pretty much most of the online docs at the matplotlib sourceforge site, but didn't find what I was looking for. I went through...
0
by: dhn | last post by:
I am trying to automate the generation of scatterplots in matplotlib. The problem of where to put the labels is known as 'point-feature labeling' (a main application is in cartography, where cities...
2
by: Grant Edwards | last post by:
I downloaded examples/contour_demo.py, and it doesn't run. I've searched both the user guide and the Wiki for "contour" and got zero hits. ...
5
by: John Henry | last post by:
I've been asking this question at the matplotlib user list and never gotten an answer. I am hoping that there are matplotlib users here that can help. My problem with matplotlib's way of...
0
by: Soren | last post by:
Hi, I'm trying to create a small GUI program where I can do plots using Matplotlib. I've been trying to borrow code from the examples at the matplotlib website, but I can't get it to work. I...
4
by: Bill Jackson | last post by:
Hi, I'm having some trouble plotting with the following matplotlibrc: text.usetex : True I tried clearing the cache files under ~/.matplotlib, but this did not help the problem. I'd post...
1
by: Eric Holbrook | last post by:
I'm using matplotlib to generate (and save) plots of bandwidth data from simulation logs. Since the simulations are of varying lengths, i need a way to scale the axes so that every 100,000 points...
0
by: =?ISO-8859-1?Q?Fr=E9d=E9ric_Degraeve?= | last post by:
Hi everybody, I've got a problem concerning matplotlib/pylab. I use it to represent curves. I will use these pictures in a report. However, it writes me a string 'date' on the bottom of my x-axis....
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.