Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to plot stranded plastics with a different color #1376

Open
nordam opened this issue Aug 21, 2024 · 1 comment
Open

Trying to plot stranded plastics with a different color #1376

nordam opened this issue Aug 21, 2024 · 1 comment

Comments

@nordam
Copy link

nordam commented Aug 21, 2024

Using example_plast as a starting point, I'm trying to get o.plot() to show stranded plastics in a different color. I had a look in the code, and it seems colors are decided by the dictionary status_colors. I tried passing this as an argument to the drifter class:

o2 = PlastDrift(loglevel=20)
o2.add_reader([reader_norkyst])
o2.seed_elements(lon, lat, radius=50, number=3000, time=time, wind_drift_factor=0.1, terminal_velocity=0.02, status_colors={'initial': 'green', 'active': 'blue', 'stranded':'red'})

But this gives me an error message:

TypeError: Redundant arguments: ['status_colors']

Is there another way to achieve the different colors?

@knutfrode
Copy link
Collaborator

knutfrode commented Aug 21, 2024

Yes, status_colors is not an input parameter to the plot methods (it could have been), but instead a property of the class, and can thus have different default values for different classes.

So you can set it before your plotting:
o2.status_colors={'initial': 'green', 'active': 'blue', 'stranded':'red'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants