Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4613712
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:35:34+00:00 2026-05-22T01:35:34+00:00

I recently moved from matplotlib version ‘0.99.1.1’ to ‘1.0.1’. A new glitch i’m encountering

  • 0

I recently moved from matplotlib version ‘0.99.1.1’ to ‘1.0.1’.
A new glitch i’m encountering has to do with “automatic axis dimensioning’ … not all datapoints end up being shown. Here is some code that reproduces my problem, some more discussion is below.

import datetime
from pylab import *
print matplotlib.__version__
x = [datetime.date(2011,2,11),
     datetime.date(2011,3,11),
     datetime.date(2011,4,11),
     datetime.date(2011,5,11),
     datetime.date(2011,6,11),
     datetime.date(2011,7,11)]
y = [23,41,67,72,18,19]
fig = figure()
ax = fig.add_subplot(111)
ax.plot_date(x, y, 'kx')

# next task is to broaden the xaxis so that it begins 
# and ends at the start of a month (approximately).  
xmin, xmax, ymin, ymax = ax.axis() ; print xmin, xmax, ymin, ymax
a1 = xmin - min(x).day + 1
a2 = xmax - max(x).day + 31

#a1 = datetime.date(1,1,1) + datetime.timedelta(a1)
#a2 = datetime.date(1,1,1) + datetime.timedelta(a2)

#ax.axis([a1,a2,ymin,ymax]) #

ax.plot_date(a1, ymin, 'ko')
ax.plot_date(a2, ymin, 'ko')

show()

under 0.99.1, the above code worked fine as a workaround for (seemingly) not being able to reset the xaxis via an ax.axis(v) statement. Now, under 1.0.1, the two ‘ko’ points end up being outside the axes regardless of whether ax.plot_date is called using a1 and a2 in units of ‘days’ or ‘datetime.date’.

it is possible that the two ‘ko’ points are not being plotted. but to observe that they are infact being plotted, uncomment the ax.axis(v) call (which works fine in 1.0.1) and then look for the two quarter-circles in the bottom corners of the axes area.

while it is true that a cleaner way to expand the xaxis is to use an ax.axis(v) statement, the above behavior makes me nervous about the ‘auto axes dimensioning’ … although its more likely that i am incorrectly coding something or another.

EDIT: fwiw … the following code allows broadening to the 1st of the months, precisely

xmin, xmax, ymin, ymax = ax.axis() #; print xmin, xmax, ymin, ymax
a1 = datetime.date.fromordinal(int(xmin)) #; print 'a1= ', a1
a2 = datetime.date.fromordinal(int(xmax)) #; print 'a2= ', a2

y1, m1 = a1.year, a1.month 
y2, m2 = a2.year, a2.month + 1

a1 = datetime.date(y1,m1,1) #; print 'a1= ', a1
a2 = datetime.date(y2,m2,1) #; print 'a2= ', a2

ax.axis([a1,a2,ymin,ymax])
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:35:35+00:00Added an answer on May 22, 2026 at 1:35 am

    What’s happening is that the axis isn’t set to “automatically dimension” after you call ax.axis(). Calling axis turns off autoscaling (it assumes that if you’re manually getting the axis limits, you probably don’t want them to change).

    Just add an ax.axis('auto') or an ax.set_autoscale_on() after you plot everything.

    import datetime
    import matplotlib.pyplot as plt
    x = [datetime.date(2011,2,11),
         datetime.date(2011,3,11),
         datetime.date(2011,4,11),
         datetime.date(2011,5,11),
         datetime.date(2011,6,11),
         datetime.date(2011,7,11)]
    y = [23,41,67,72,18,19]
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot_date(x, y, 'kx')
    
    # next task is to broaden the xaxis so that it begins 
    # and ends at the start of a month (approximately).  
    xmin, xmax, ymin, ymax = ax.axis() ; print xmin, xmax, ymin, ymax
    a1 = xmin - min(x).day + 1
    a2 = xmax - max(x).day + 31
    
    ax.plot_date(a1, ymin, 'ko')
    ax.plot_date(a2, ymin, 'ko')
    ax.axis('auto')
    
    plt.show()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm tracking a project that has recently moved from svn to git. I've got
Our SVN server has recently moved servers (from serverA to serverB). I did a
I've recently moved from VB6 to VB.NET and I am finally getting there with
I'm a Git newbie. I recently moved a Rails project from Subversion to Git.
I recently moved from a asp.net host to a PHP host. I am trying
We recently moved from a simple DB recovery model (with daily full database dumps)
We recently moved from one domain to another and now I am trying to
I recently moved from a Mac + Textmate back to Visual Studio. The one
I recently moved from NetBeans to Eclipse and I very much miss one great
We recently moved from SVN to Git, but there's a single legacy branch that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.