cartopy icon indicating copy to clipboard operation
cartopy copied to clipboard

Add get_* and set_* methods for the FeatureArtist

Open pelson opened this issue 6 years ago • 2 comments

Rationale

Support standard matplotlib setters and getters. But not their respective properties (because they have hiddeous details, such as artist.figure being the actual data that is stored on the artist, whereas artist.facecolor is just an alias to artist._facecolor).

Implications

One can use standard matplotlib machinery for stylisation, including:

feature_artist.set_facecolor('red')
plt.setp(feature_artist, 'facecolor', 'red')

Closes #1226.

pelson avatar Dec 03 '18 23:12 pelson

Couple of thoughts for myself:

  • should I deal with pchanged and prop observers
  • should I prevent certain properties (non-stylistic ones, such as data, transform etc.)

pelson avatar Dec 13 '18 12:12 pelson

Can I bump this? I ran across it a few years ago (roundabout the time of this PR) and I ran across it again recently (my workaround is to access the private "_kwargs", which does work but doing it gives me the willies). For folks familiar with matplotlib, it's counterintuitive that things like facecolor can be set at creation-time but can't be set post-creation on a FeatureArtist (because it's an artist, right?). I'm not super familiar with the inner workings so I don't know if this is still the best way to do it, but might be worth a look?

Jeitan avatar Mar 30 '22 16:03 Jeitan

Superseded by #2323.

rcomer avatar Feb 23 '24 15:02 rcomer