PGFPlots.jl icon indicating copy to clipboard operation
PGFPlots.jl copied to clipboard

Scatter Classes Legend Fill

Open bjack205 opened this issue 5 years ago • 1 comments

I'm having an issue with the scatter classes field. Here's the example from the documentation:

x = 1:10
y = 2x
z = ["a", "a", "a", "b", "b", "b", "b", "c", "c", "c"]
sc = "{a={mark=square,orange},b={mark=triangle,red},c={mark=o,black}}"
Plots.Scatter(x, y, z, scatterClasses=sc, legendentry=["A", "B", "C"])

This plots just fine; however, if the markers are filled in then the legend markers are filled in blue:

z = ["a", "a", "a", "b", "b", "b", "b", "c", "c", "c"]
sc = "{a={mark=square*,blue},b={mark=triangle*,red},c={mark=o*,black}}"
Plots.Scatter(x, y, z, scatterClasses=sc, legendentry=["A", "B", "C"])

Screenshot from 2019-07-12 18-38-02

I'm very new to PGFPlots, but I did find that changing the \addplot+[...] to \addplot[...] (avoiding \addplot+ per the documentation) fixes the issue. Not sure if that's an easy fix in PGFPlots.jl, though.

Thanks!

bjack205 avatar Jul 13 '19 01:07 bjack205

Thank you for filing this issue. I think you can just change the addplot+ commands in the function plotHelper(o::IO, p::Scatter) in src/PGFPlots.jl. If that does the trick for you, please file a PR and let's get it merged in!

mykelk avatar Jul 13 '19 06:07 mykelk