Skip to content

Commit

Permalink
Fixed missing marker in legend when plotting a series whose first ent…
Browse files Browse the repository at this point in the history
…ry is NaN (#4328)

* Changed function `gr_add_legend` to call `gr_draw_marker` instead of `gr_draw_markers`, since a legend entry only has one marker (if any).

* Resolved conflict in  (kept new method of calculating s, sw)

* Ran JuliaFormatter, reformatted long function call of  to span multiple lines
  • Loading branch information
leespen1 authored Sep 9, 2022
1 parent 8ea45ff commit f9e48b5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/backends/gr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,7 @@ function gr_add_legend(sp, leg, viewport_plotarea)
if series[:markershape] !== :none
ms = first(series[:markersize])
msw = first(series[:markerstrokewidth])
shape = Plots._cycle(series[:markershape], 1)
s, sw =
min.(
maxmarkersize,
Expand All @@ -1149,7 +1150,16 @@ function gr_add_legend(sp, leg, viewport_plotarea)
0, 0.8 * sp[:legend_font_pointsize] * msw / 8
end,
)
gr_draw_markers(series, xpos - leg.width_factor * 2, ypos, clims, s, sw)
gr_draw_marker(
series,
xpos - leg.width_factor * 2,
ypos,
clims,
1,
s,
sw,
shape,
)
end

lab = series[:label]
Expand Down

0 comments on commit f9e48b5

Please sign in to comment.