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

Legendentry kwarg for BarChart and Scatter #182

Closed
johannes-fischer opened this issue Mar 1, 2022 · 2 comments · Fixed by #183
Closed

Legendentry kwarg for BarChart and Scatter #182

johannes-fischer opened this issue Mar 1, 2022 · 2 comments · Fixed by #183

Comments

@johannes-fischer
Copy link
Contributor

Similar to #177, the legendentry keyword seems to be not working for BarChart and Scatter as well:

julia> Plots.BarChart([1,2,3],rand(3), legendentry="My Plot") |> tikzCode |> print
\begin{axis}[
  ybar = 0pt,
  bar width = 18pt,
  xtick = data,
  symbolic x coords = {1, 2, 3},
  ymin = {0}
]

\addplot+ coordinates {
  (1, 0.5346054483580505)
  (2, 0.8031940282685136)
  (3, 0.7360737650114937)
};

\end{axis}

For scatter there is the following example in the docs that uses legendentry, but it also seems to be broken in the notebook:

julia> x = 1:10; y = 2x
julia> z = ["a", "a", "a", "b", "b", "b", "b", "c", "c", "c"]
julia> sc = "a={mark=square,blue}, b={mark=triangle,red}, c={mark=o,black}"
julia> Plots.Scatter(x, y, z, scatterClasses=sc, legendentry=["A", "B", "C"]) |> tikzCode |> print
\begin{axis}

\addplot+[
  scatter,
  scatter src = explicit symbolic,
  only marks = {true},
  scatter/classes = {a={mark=square,blue}, b={mark=triangle,red}, c={mark=o,black}}
] coordinates {
  (1, 2) [a]
  (2, 4) [a]
  (3, 6) [a]
  (4, 8) [b]
  (5, 10) [b]
  (6, 12) [b]
  (7, 14) [b]
  (8, 16) [c]
  (9, 18) [c]
  (10, 20) [c]
};

\end{axis}
@mykelk
Copy link
Member

mykelk commented Mar 1, 2022

Thanks for filing this! Are you interested in contributing a PR? Otherwise, I can take a look next week.

@johannes-fischer
Copy link
Contributor Author

Yeah, I'll take a look at it some time in the next days.

mykelk added a commit that referenced this issue Mar 7, 2022
Fix legendentry for Barchart and Scatter (#182)
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 a pull request may close this issue.

2 participants