Discussion:
[Matplotlib-users] Removing a shapefile after it is loaded
Ronquillo, Edgar Nahum
2015-07-01 17:58:32 UTC
Permalink
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
Benjamin Root
2015-07-01 18:09:39 UTC
Permalink
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
Post by Ronquillo, Edgar Nahum
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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...