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 8167657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:15:59+00:00 2026-06-06T20:15:59+00:00

I am plotting a scatter plot on a Basemap. However, the data with this

  • 0

I am plotting a scatter plot on a Basemap. However, the data with this scatter plot changes based on user input. I would like to clear the data (only the data — not the entire basemap figure) and re-plot new scatter points.

This question is similar but was not answered (http://stackoverflow.com/questions/8429693/python-copy-basemap-or-remove-data-from-figure)

Currently I am closing the figure with clf(); however, this requires me to re-draw the entire basemap and scatter plot together. On top of this, I am doing all of the redrawing inside of a wx panel. The basemap redraw takes too long and am hoping that there is an easy way to simply re-plot scatter points only.

#Setting up Map Figure 
self.figure = Figure(None,dpi=75) 
self.canvas = FigureCanvas(self.PlotPanel, -1, self.figure) 
self.axes = self.figure.add_axes([0,0,1,1],frameon=False) 
self.SetColor( (255,255,255) ) 

#Basemap Setup 
self.map = Basemap(llcrnrlon=-119, llcrnrlat=22, urcrnrlon=-64, 
                urcrnrlat=49, projection='lcc', lat_1=33, lat_2=45, 
                lon_0=-95, resolution='h', area_thresh=10000,ax=self.axes) 
self.map.drawcoastlines() 
self.map.drawcountries() 
self.map.drawstates() 
self.figure.canvas.draw() 

#Set up Scatter Plot 
m = Basemap(llcrnrlon=-119, llcrnrlat=22, urcrnrlon=-64, 
        urcrnrlat=49, projection='lcc', lat_1=33, lat_2=45, 
        lon_0=-95, resolution='h', area_thresh=10000,ax=self.axes) 

x,y=m(Long,Lat) 

#Scatter Plot (they plot the same thing) 
self.map.plot(x,y,'ro') 
self.map.scatter(x,y,90) 

self.figure.canvas.draw() 

Then I do an some type of update on my (x,y)…

#Clear the Basemap and scatter plot figures
self.figure.clf()

Then I repeat all of the above code. (I also have to redo my box sizers for my panel — I did not include these).

Thanks!

  • 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-06T20:16:01+00:00Added an answer on June 6, 2026 at 8:16 pm

    The matplotlib.pyplot.plot documentation mentions that the plot() command returns a Line2D artist which has xdata and ydata properties, so you might be able to do the following:

    # When plotting initially, save the handle
    plot_handle, = self.map.plot(x,y,'ro') 
    ...
    
    # When changing the data, change the xdata and ydata and redraw
    plot_handle.set_ydata(new_y)
    plot_handle.set_xdata(new_x)
    self.figure.canvas.draw()
    

    I haven’t managed to get the above to work for collections, or 3d projections, unfortunately.

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

Sidebar

Related Questions

I'm plotting some data curves with gnuplot, and they look like this: However, the
I would like to create a density plot using basemap. The data I have
When plotting a function using Plot, I would like to obtain the set of
I would like to use a plotting tool to visualize data for image processing.
I am plotting boxplots from this data: MY_LABEL MY_REAL MY_CATEGORY 1 [POS] .56 POS
I'm plotting rose diagrams using Matlab7. And I would like to add an extra
I'm plotting data which extent, in x, from -1000 to 1000. But I'm only
I'm plotting a scatter plot with three columns: Green group: x y pointlabel 48,6
I am plotting a boxplot without the outliers and I would like to create
I need help on plotting the bar chart to show daily based statistics like

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.