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

  • Home
  • SEARCH
  • 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 7963813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:42:14+00:00 2026-06-04T05:42:14+00:00

I am plotting data in a plot using wxPython where the data limits on

  • 0

I am plotting data in a plot using wxPython where the data limits on the y- axis are changing with the data. I would like to change the axis dynamically without redrawing the whole canvas like canvas.draw() rather I’d like to use blitting for this as I do for the plot itself.

What I got to work is the changing y-axis, and I get the yticks animated with the plot, unfortunately the ylabels are gone and I cant find the solution. The reason is setting the get_yaxis().set_animated(True) setting for the axis.

I put together a little working example in the following.
What am I missing here?

import matplotlib
matplotlib.use('WXAgg')

import wx
import pylab as p
import numpy as npy
from time import sleep

ax = p.subplot(111)
canvas = ax.figure.canvas
x = npy.arange(0,2*npy.pi,0.01)
line, = p.plot(x, npy.sin(x), animated=True)

ax.get_yaxis().set_animated(True)

def update_line(*args):
    if update_line.background is None:
        update_line.background = canvas.copy_from_bbox(ax.bbox)

    for i in range(20):
        canvas.restore_region(update_line.background)

        line.set_ydata((i/10.0)*npy.sin(x))
        ax.set_ylim(-1*i/5.0-0.5,i/5.0+0.5)

        ax.draw_artist(ax.get_yaxis())

        ax.draw_artist(line)

        canvas.blit(ax.bbox)

        sleep(0.1)
    print 'end'


update_line.cnt = 0
update_line.background = None
wx.EVT_IDLE(wx.GetApp(), update_line)
p.show()

Basically I am looking for something like get_ylabels().set_animated(True) but I cant find it.

  • 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-06-04T05:42:16+00:00Added an answer on June 4, 2026 at 5:42 am

    It looks like the labels are drawn but the blit command doesn’t copy them over to the canvas because the bounding box only includes the inner part of the axes.

    For me changing update_line.background = canvas.copy_from_bbox(ax.bbox) to update_line.background = canvas.copy_from_bbox(ax.get_figure().bbox) and canvas.blit(ax.bbox) to canvas.blit(ax.clipbox) made it work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using MATLAB to plot some data. I would like to create the legend
When plotting a function using Plot, I would like to obtain the set of
I'm plotting a group of curves, using facet in ggplot2. I'd like to have
I'm writing a graphical user interface to plot data on a xy-axis. It's written
I'm using rpy2 to do data analysis and plotting in python. It works fine
When plotting multiple data series using both line specification ( X , Y ,
I am thinking of using wxMathPlot for plotting/graphing some data that arrives continuously. I
I am plotting some curves using twin-axis and also scientific notation. I have set
I am plotting a continuous variable against a factor using plot() in R (see
I want to write a bash script to automate the plotting of data, using

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.