Skip to content

Conversation

nilshg
Copy link

@nilshg nilshg commented Mar 30, 2021

scatterpath leads to lines being a different colour from markers, and the markers can end up being the same colour as different lines on the same plot, making the legend very confusing.

`scatterpath` leads to lines being a different colour from markers, and the markers can end up being the same colour as different lines on the same plot, making the legend very confusing.
@nilshg
Copy link
Author

nilshg commented Mar 30, 2021

I've initially raised this on Zulip but thought I'd just PR straight away - this essentially moves us from
image

to
image

@BeastyBlacksmith
Copy link
Member

If we are to go with this PR I would leave the marker be :circle, but actually I would prefer to fix scatterpath to have the same color for markers and line

@nilshg
Copy link
Author

nilshg commented Apr 8, 2021

That's a very good point, I generally can't see why one would want different colours when plotting a scatterpath.

Is it this recipe here: https://github.com/JuliaPlots/Plots.jl/blob/0a84ff8caff94e1923d379465d14998835e24d18/src/recipes.jl#L164?

I just monkey-patched it locally by adding color := 1 and that seems to do the trick, but I'm assuming that's a bit heavy handed. Not sure how to tell it to use the same color for both series without fixing the color?

@BeastyBlacksmith
Copy link
Member

BeastyBlacksmith commented Apr 8, 2021

color := plotattr[:seriescolor] might work

Else making it a path with markers like in this PR should also work

@nilshg
Copy link
Author

nilshg commented Apr 8, 2021

Sorry, can't get that to work - color := plotattr[:seriescolor] complains that there's no method matching getindex(::typeof(plotattr), ::Symbol) (is plotattr a function?), and any other changes I make to try and align it with what's in here give me a pretty inscrutable ERROR: The seriestype didn't change in series recipe scatterpath. This will cause a StackOverflow. Looks like this is beyond me!

@BeastyBlacksmith
Copy link
Member

should be a dictionary, but maybe the name was plotattributes? Its some time I worked on this ^^;

@BeastyBlacksmith
Copy link
Member

may be fixed by JuliaPlots/Plots.jl@64f3d58

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

Successfully merging this pull request may close these issues.

2 participants