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

Support for disabling axis ticks in UnicodePlots #4681

Merged
merged 4 commits into from
Mar 6, 2023
Merged

Support for disabling axis ticks in UnicodePlots #4681

merged 4 commits into from
Mar 6, 2023

Conversation

ivan-boikov
Copy link
Contributor

Fixes #4657

@codecov
Copy link

codecov bot commented Mar 4, 2023

Codecov Report

Patch coverage: 42.85% and project coverage change: +0.13 🎉

Comparison is base (511784f) 90.26% compared to head (9605795) 90.40%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4681      +/-   ##
==========================================
+ Coverage   90.26%   90.40%   +0.13%     
==========================================
  Files          40       40              
  Lines        8704     8712       +8     
==========================================
+ Hits         7857     7876      +19     
+ Misses        847      836      -11     
Impacted Files Coverage Δ
src/backends/unicodeplots.jl 93.86% <ø> (ø)
src/axes.jl 89.17% <42.85%> (-0.70%) ⬇️
RecipesPipeline/src/RecipesPipeline.jl 100.00% <0.00%> (ø)
src/args.jl 85.56% <0.00%> (+0.14%) ⬆️
src/backends.jl 82.58% <0.00%> (+0.49%) ⬆️
src/components.jl 90.67% <0.00%> (+0.51%) ⬆️
RecipesPipeline/src/utils.jl 97.26% <0.00%> (+1.36%) ⬆️
RecipesPipeline/src/series.jl 93.58% <0.00%> (+2.56%) ⬆️
src/examples.jl 99.20% <0.00%> (+3.17%) ⬆️

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

t-bltg commented Mar 5, 2023

In the UnicodePlots context, get_ticks can be expensive (it actually computes ticks which are unused for this backend).

I would instead add a has_ticks helper in axes.jl loosely defined as:

_has_ticks(::Any) = true  # catchall
_has_ticks(s::Symbol) = s !== :none
_has_ticks(::Nothing) = false
_has_ticks(b::Bool) = b

has_ticks(axis) = get(axis, :ticks, nothing) |> _has_ticks

, and use the following instead:

xticks = has_ticks(xaxis),
yticks = has_ticks(yaxis),

@ivan-boikov
Copy link
Contributor Author

I would instead add a has_ticks helper in axes.jl

Good call. I will also add overloads for Tuple and AbstractVector in a few moments if that's alright.

src/axes.jl Outdated Show resolved Hide resolved
@t-bltg t-bltg merged commit 20726c8 into JuliaPlots:master Mar 6, 2023
@t-bltg
Copy link
Member

t-bltg commented Mar 6, 2023

Thanks 👍

@ivan-boikov ivan-boikov deleted the ib-up-ticks branch March 23, 2023 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FR] Support xticks, yticks with UnicodePlots
2 participants