Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@grantmcdermott
Copy link
Owner

Closes #366

Operationalised through the new xaxb and yaxb args. Should play nicely with axis limits and the panel grid, as well as any formatting adjustments applied through x/yaxl.

pkgload::load_all("~/Documents/Projects/tinyplot")
#> ℹ Loading tinyplot

plt(
  mpg ~ hp | am, mtcars, facet = "by",
  xaxb = c(80, 160, 240, 320),
  yaxb = c(12, 16, 24, 40),
  grid = TRUE
)

plt(
  count ~ spray,
  data = InsectSprays,
  xaxb = c("A", "C", "F"), xaxl = tolower, 
  yaxb = c(10, 30), yaxl = "$"
)

Created on 2025-05-17 with reprex v2.1.1

@grantmcdermott
Copy link
Owner Author

@vincentarelbundock I think that this covers the use case/need that you had in mind. Would you mind reviewing or taking a quick look when you get a chance?

@vincentarelbundock
Copy link
Collaborator

Thanks, this is exactly what I needed. A really important feature! (sorry I didn't get to it in time).

The only comment I have is about whether we should give xaxb or xlim priority when both are specified and enter in conflict. My gut says that xlim should have priority since it is a base setting, but I don't feel super strongly about it.

Rest looks great.

@zeileis
Copy link
Collaborator

zeileis commented May 18, 2025

Nice! We also need to incorporate that into type_spineplot(). The xaxb would be the default for breaks unless the latter is specified by the user. The yaxb should be taken to indicate which of the y-axis categories should be labeled or not.

@grantmcdermott
Copy link
Owner Author

grantmcdermott commented May 18, 2025

Nice! We also need to incorporate that into type_spineplot(). The xaxb would be the default for breaks unless the latter is specified by the user. The yaxb should be taken to indicate which of the y-axis categories should be labeled or not.

Good catch. So, internally we would just need to make sure that (say) xaxb is transferred to breaks.

Question, though: Should we hide these type_spineplot()-specific arguments from the user then and rather enforce that they go through the top-level x/yaxb arguments for consistency? I know it would be a breaking change, but I think we should favour a single (common) top-level approach for doing something if possible. Alternatively, if we keep them, which takes precedence if the user specifies both (say) xaxb and type_spineplot(breaks = ...)? (Edit: Ignore and see below.)

@grantmcdermott
Copy link
Owner Author

grantmcdermott commented May 19, 2025

Question, though: Should we hide these type_spineplot()-specific arguments from the user then and rather enforce that they go through the top-level x/yaxb arguments for consistency? I know it would be a breaking change, but I think we should favour a single (common) top-level approach for doing something if possible. Alternatively, if we keep them, which takes precedence if the user specifies both (say) xaxb and type_spineplot(breaks = ...)?

Sorry, ignore what I was saying above. I was quickly typing on my phone while I was out and hadn't read your comments properly or thought about it clearly. I now recall that type_spineplot(breaks = ...) accepts a single number (analogous to histograms), whereas xaxb specifies the exact break points. As such, I agree with your comment @zeileis that "xaxb would be the default for breaks unless the latter is specified by the user."

@zeileis
Copy link
Collaborator

zeileis commented May 19, 2025

Like in hist(), the breaks can be both, either the number of breaks or the location of the breaks. So if xaxb is specified and breaks is not (i.e., NULL), breaks = xaxb can be used.

@grantmcdermott
Copy link
Owner Author

Okay, I think we're good to go. Thanks both for the comments and suggestions ;-)

@grantmcdermott grantmcdermott merged commit d03a30a into main May 19, 2025
3 checks passed
@grantmcdermott grantmcdermott deleted the xaxb branch May 19, 2025 04:50
@zeileis
Copy link
Collaborator

zeileis commented May 19, 2025

Thanks!

zeileis added a commit that referenced this pull request May 22, 2025
…sticker (#411)

* Handle xmin/xmax/ymin/ymax along with model.frame (#403)

* handle xmin/xmax/ymin/ymax along with model.frame

* turn facet into a formula if it does not evaluate successfully

* document min/max processing in NEWS and ?tinyplot

* typo

* use formula-based syntax for pointrange/errorbar

* run devtools::document

* Support manual breaks (`x/yaxb`) (#400)

* support xaxb/yaxb

* smol example

* add test

* news

* vincent comment

* fix spineplot ylevels bug (#404)

* achim's comment

- spineplot integration

* minor doc fix

* news

* Add warnings and documentation for adding to faceted plots (#407)

* only save pars when add == FALSE

* Positron warning

* document limitations

* typos

* feat: Added 'tinyplot' writing (font Roboto Condensed) to top navigation, added background (dots) inspired by the logo. In addition, vectorized the logo and added the original (Inkscape SVG) as well as a sticker version (plain SVG) in the new 'inst' folder.

---------

Co-authored-by: Achim Zeileis <[email protected]>
Co-authored-by: Grant McDermott <[email protected]>
grantmcdermott added a commit that referenced this pull request May 23, 2025
* cosmo theme with custom colors based on teal/pink/black from hex sticker

* set favicon (based on hex canvas), image, site-url

* use navbar for main navigation and sidebar only in reference

* forgot to add favicon.png

* reorganize reference in navbar+sidebar, use ALTDOC_* variables which are available

* nest plot types

* use white instead of pink in navbar, add border-bottom for hovered/selected links

* add mcanouil/iconify extension for bsky icon

* streamline left navbar (collapse Articles and About), add bsky and mastodon to right navbar

* move hex sticker out of h1 title so that it isn't duplicated in the toc; some further minor tweaks in links/badges

* Updated top navigation design (text logo + background), added logo + sticker (#411)

* Handle xmin/xmax/ymin/ymax along with model.frame (#403)

* handle xmin/xmax/ymin/ymax along with model.frame

* turn facet into a formula if it does not evaluate successfully

* document min/max processing in NEWS and ?tinyplot

* typo

* use formula-based syntax for pointrange/errorbar

* run devtools::document

* Support manual breaks (`x/yaxb`) (#400)

* support xaxb/yaxb

* smol example

* add test

* news

* vincent comment

* fix spineplot ylevels bug (#404)

* achim's comment

- spineplot integration

* minor doc fix

* news

* Add warnings and documentation for adding to faceted plots (#407)

* only save pars when add == FALSE

* Positron warning

* document limitations

* typos

* feat: Added 'tinyplot' writing (font Roboto Condensed) to top navigation, added background (dots) inspired by the logo. In addition, vectorized the logo and added the original (Inkscape SVG) as well as a sticker version (plain SVG) in the new 'inst' folder.

---------

Co-authored-by: Achim Zeileis <[email protected]>
Co-authored-by: Grant McDermott <[email protected]>

* switch order of NEWS and Citation

* increase depends to R 4.1.0 due function shorthand (would be added by R CMD build with a warning)

* add CITATION file, currently just based on package DESCRIPTION but using the CRAN DOI (rather than another URL)

* Include improved version of logo in web package

- altdoc page includes both logo.svg (vector graphic) and logo.png (500x578)
- zoomed-in favicon in higher resolution (500x500)
- README uses online logo from grantmcdermott.com (works only after first publication)
- drop low-resolution version of old logo from man/figures/

---------

Co-authored-by: Grant McDermott <[email protected]>
Co-authored-by: Reto Stauffer <[email protected]>
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.

Manual breaks

4 participants