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

widen Legend patches in thinned theme #24

Merged
merged 1 commit into from
May 21, 2024

Conversation

musoke
Copy link
Contributor

@musoke musoke commented May 7, 2024

The thinned theme changes the size of patches in Legends. This means that the :solid, :dash and :dot lifestyles are hard to distinguish.

Widen patchsize from (8, 8)to(20, 8)`.

There may be some reason I'm unaware of for not doing this.

Copy link

codecov bot commented May 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.68%. Comparing base (e2a90b0) to head (3153918).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #24   +/-   ##
=======================================
  Coverage   92.68%   92.68%           
=======================================
  Files           4        4           
  Lines          41       41           
=======================================
  Hits           38       38           
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

The thinned theme changes the size of patches in `Legend`s.  This means
that the `:solid`, `:dash` and `:dot` lifestyles are hard to
distinguish.

Widen `patchsize` from (8, 8)` to `(20, 8)`.

Fixes: nathanaelbosch#22
Copy link
Owner

@nathanaelbosch nathanaelbosch left a comment

Choose a reason for hiding this comment

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

Good idea, thanks for the input! At first sight (20,8) seems a bit wide, maybe (16,8) is sufficient? Or if you have a minimal code example or some figures that show a comparison those could also be helpful to find a good value.

@musoke
Copy link
Contributor Author

musoke commented May 20, 2024

Running this script:

using CairoMakie, TuePlots, Random

data = cumsum(randn(Xoshiro(2), 4, 201), dims = 2)

for (p,) in [8, 16, 20]

    theme = merge(
        Makie.Theme(Legend = (patchsize = (p, 8),)),
        Theme(
            TuePlots.SETTINGS[:AISTATS];
            thinned = true
        )
    )

    with_theme(theme) do
        series(
            data,
            labels = ["label $i" for i in 1:4],
            linestyle=[:solid, :dash, :dot, :dashdot],
            axis=(title="patchsize = ($p, 8)",),
        )
        axislegend()

        display(current_figure())
    end
end

I got this output
image
image
image

In my opinion 16 is a little too narrow --- the :dash output doesn't quite have a full second dash to distinguish it from :dashdot. It might be sufficient for most cases though.

@nathanaelbosch
Copy link
Owner

Looks convincing! I'll go ahead and merge. Thanks again for the PR!

@nathanaelbosch nathanaelbosch merged commit 2985ba6 into nathanaelbosch:main May 21, 2024
7 checks passed
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