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

Filtering "missing" tick labels #4716

Merged
merged 3 commits into from
Apr 17, 2023
Merged

Filtering "missing" tick labels #4716

merged 3 commits into from
Apr 17, 2023

Conversation

ivan-boikov
Copy link
Contributor

Description

Closes #4715
With 10 items in a CategoricalArray spacing between ticks becomes smaller than the padding and a new tick is squeezed in. Its value is not defined however and the CategoricalArrays.jl recipe gives out a missing tick label, on which a label formatter chokes.

Feels like a band-aid rather than a solution though.

Test code
using Plots, CategoricalArrays
plot(
    bar(categorical(collect(1:9)), collect(1:9)),
    bar(categorical(collect(1:10)), collect(1:10);); 
    size=(4,1).*100
)

image

Attribution

@codecov
Copy link

codecov bot commented Apr 5, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.40 🎉

Comparison is base (0e0f117) 90.00% compared to head (2ec1904) 90.40%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4716      +/-   ##
==========================================
+ Coverage   90.00%   90.40%   +0.40%     
==========================================
  Files          40       40              
  Lines        8360     8727     +367     
==========================================
+ Hits         7524     7890     +366     
- Misses        836      837       +1     
Impacted Files Coverage Δ
src/axes.jl 89.19% <100.00%> (+0.11%) ⬆️

... and 32 files with indirect coverage changes

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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@BeastyBlacksmith
Copy link
Member

I think that the CategoricalArrays recipe should give an empty string insterad of missing in this case.

@ivan-boikov
Copy link
Contributor Author

I think that the CategoricalArrays recipe should give an empty string insterad of missing in this case.

In JuliaData/CategoricalArrays.jl#340, they call the use of missing a hack. Perhaps they chose it and not a blank string to avoid collision -- CategoricalArrays might have empty strings as legitimate categories?

@BeastyBlacksmith BeastyBlacksmith merged commit c16a009 into JuliaPlots:master Apr 17, 2023
@ivan-boikov ivan-boikov deleted the cat-missing branch April 20, 2023 19:03
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.

[BUG] Bar plot with categorical labels
2 participants