Removing a shapefile after it is loaded

Hello All,

I am working with Basemap and loading several shapefiles using checkboxes in python. However, when I uncheck a checkbox I would like a shapefile to be removed and stay with the other shapefiles that are already loaded. I tried reloading
and replotting the whole thing when I remove a checkbox but it will remove all the other shapefiles as well. In simpler words, is it possible to remove a shapefile from Basemap after m.readshapefile() has been called?

Thanks in advance

You would need to save the artist object that is returned by drawshapefile() in a list or something. Then, when you want to get rid of it. you can call its remove() method or just do a set_visible(False) to just hide it. This all requires having a reference to the artist object itself.

Does that help?

Ben Root

···

On Wed, Jul 1, 2015 at 1:58 PM, Ronquillo, Edgar Nahum <eronquillo@…652…> wrote:

Hello All,

I am working with Basemap and loading several shapefiles using checkboxes in python. However, when I uncheck a checkbox I would like a shapefile to be removed and stay with the other shapefiles that are already loaded. I tried reloading
and replotting the whole thing when I remove a checkbox but it will remove all the other shapefiles as well. In simpler words, is it possible to remove a shapefile from Basemap after m.readshapefile() has been called?

Thanks in advance


Don’t Limit Your Business. Reach for the Cloud.

GigeNET’s Cloud Solutions provide you with the tools and support that

you need to offload your IT needs and focus on growing your business.

Configured For All Businesses. Start Your Cloud Today.

https://www.gigenetcloud.com/


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users