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

gr: support horizontal legends #4496

Merged
merged 23 commits into from
Nov 7, 2022
Merged

gr: support horizontal legends #4496

merged 23 commits into from
Nov 7, 2022

Conversation

t-bltg
Copy link
Member

@t-bltg t-bltg commented Nov 5, 2022

Fix #2206.
Fix #4497 (and add regression tests).

It's a tough one since the gr code is a mess, non generic, easily breakable (some legend code paths are not tested in ref imgs), etc...

Add the ability to draw legend bounding boxes (for debugging, when using Plots.debugplots(true)).
Fix centering of legend boxes (:top and :bottom), and position of legend title.

These examples should cover most of the legend boxes possibilities:

julia> using Plots; Plots.debugplots(true);
julia> kw = (legend_column=-1, legend_title="title");
julia> plot([1:2 reverse(1:2)]; marker=:circle, kw...)
julia> plot(1:2, fillrange=reverse(1:2); kw...)
julia> plot(rand(100); reg = true, fill = (0, :green), kw...)
julia> hspan([1, 2, 3, 4]; kw...)

Supersedes #4444.

Xref #2423.

Added new examples to cover the issues encountered in #4485 and #4491:
1.35.8 - inner - ex64
64_old

pr - inner - ex64
ref64

1.35.8 - outer - ex65
65_old

pr - outer - ex65
ref65

@t-bltg t-bltg added the GR label Nov 5, 2022
@t-bltg t-bltg marked this pull request as draft November 5, 2022 12:49
@t-bltg t-bltg force-pushed the horz branch 7 times, most recently from ca1faba to ee8a5c3 Compare November 5, 2022 13:26
@t-bltg t-bltg changed the title gr: support horiontal legends gr: support horizontal legends Nov 5, 2022
@t-bltg t-bltg force-pushed the horz branch 3 times, most recently from 17dbcbc to 787d99a Compare November 5, 2022 14:09
@codecov
Copy link

codecov bot commented Nov 5, 2022

Codecov Report

Base: 90.88% // Head: 90.64% // Decreases project coverage by -0.24% ⚠️

Coverage data is based on head (e66a017) compared to base (9a8e9c7).
Patch coverage: 80.99% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4496      +/-   ##
==========================================
- Coverage   90.88%   90.64%   -0.25%     
==========================================
  Files          40       40              
  Lines        7650     7354     -296     
==========================================
- Hits         6953     6666     -287     
+ Misses        697      688       -9     
Impacted Files Coverage Δ
src/backends/gr.jl 92.15% <76.76%> (-0.45%) ⬇️
src/examples.jl 98.50% <100.00%> (+0.17%) ⬆️
src/layouts.jl 95.49% <100.00%> (-0.24%) ⬇️
src/utils.jl 93.23% <100.00%> (+0.08%) ⬆️
src/Plots.jl 78.94% <0.00%> (-5.27%) ⬇️
RecipesPipeline/src/api.jl 81.81% <0.00%> (-1.52%) ⬇️
src/backends.jl 93.68% <0.00%> (-1.17%) ⬇️
src/backends/hdf5.jl 83.58% <0.00%> (-0.93%) ⬇️
RecipesPipeline/src/series_recipe.jl 92.30% <0.00%> (-0.80%) ⬇️
RecipesPipeline/src/group.jl 94.02% <0.00%> (-0.57%) ⬇️
... and 24 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@t-bltg
Copy link
Member Author

t-bltg commented Nov 7, 2022

@BeastyBlacksmith, I've updated all the images in this PR, and I think we have the correct behavior in terms of positioning and symmetry.

Do you have any more comments, before this goes in (pending ci) ?

I am going to make it Plots@1.36.0 after merge, since there are some slight box positioning changes / fixes in vertical mode.

@t-bltg t-bltg marked this pull request as ready for review November 7, 2022 12:35
Copy link
Member

@BeastyBlacksmith BeastyBlacksmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this :)

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

Successfully merging this pull request may close these issues.

Horizontal legends [BUG] legend_position not working with GR
2 participants