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

Wishlist: Global options #33

Closed
grantmcdermott opened this issue May 1, 2023 · 4 comments
Closed

Wishlist: Global options #33

grantmcdermott opened this issue May 1, 2023 · 4 comments
Labels
wishlist Features we'd like to support

Comments

@grantmcdermott
Copy link
Owner

grantmcdermott commented May 1, 2023

Allow users to set things outside of par. Palette defaults would be an obvious candidate. (Not true: Should be via palette as per #44). Maybe default legend position. Other "theme" options like grid and frame.plot. Any others?

@grantmcdermott grantmcdermott added the wishlist Features we'd like to support label May 1, 2023
@grantmcdermott
Copy link
Owner Author

My current thinking: Add a par2() function for setting these additional global options, which would also "nest" conventional par arguments. (With the latter being passed through ...?) Supporting the nesting/passing of regular par arguments would allow users just to do everything through a single par2() call, instead of trying to remember which global options are supported by which function.

So, for example, par2(grid = TRUE, las = 1) would enact the first argument directly, but pass the second argument to par() internally.

@J-Moravec
Copy link

Is par2() planned to be used only for plot2 or perhaps for other derived custom functions, and thus would par2 members/fields be hard-coded?

For instance, I create a new plot (not necessarily) based on plot2 with a new argument specifying whatever. I would like to offload some parameters to par, but can't since those are hard-coded, this is impossible.

Also, something like plot2(..., style = par2(...)) to create a few styles that could be passed around would be cool, although I can't imagine many normal uses for this.

Love the PKG btw! Big fan of base R graphics and constantly annoyed by the difficulty of plotting legend.

grantmcdermott added a commit that referenced this issue Dec 1, 2023
- Related to a larger goal (#33). But right now to help solve the add=TRUE misalignment with faceted plots.
@grantmcdermott
Copy link
Owner Author

Hi @J-Moravec sorry for being slow; this issue has been on the backburner. I’m going to turn my attention to it once #83 is merged (since that actually introduces par2 as a side effect, which could then be refined and expanded on).

Tbh I’m strongly inclined towards hard coding the par2 fields, since this would give us better control. No promises, but maybe if you can give some concrete examples I’ll reconsider?

Thanks for kind words about the package!

grantmcdermott added a commit that referenced this issue Dec 4, 2023
* Basic facet support

- Currently only single variable (row)

* Better facet support for density objects

* Comment for self

* Fix x ordering for facet plots

* Fix faceting for density plots when facet = "by"

* Tweak "by" arg definition

* Better comments

* xlab and ylab should be part of global titles logic, even with facets

* Update tests

- To catch simple changes in plotting order

* Add plot2 options

- Related to a larger goal (#33). But right now to help solve the add=TRUE misalignment with faceted plots.

* Catch for add=TRUE with faceted plots

- Also fixes custom user mfrow setting override.

* Catch if facet = "by" and by isn't a factor

* Add facet tests

* clean up

* Fix local checks

* Catches for CI tests with dev R

- Grid lines are going to change slightly

* Add facet example to README

* Update examples

* NEWS and version bump

* Add facet example to vignette

* Website + docs

* Website + docs

* Ignore build cruft

* Attempt fix for CI release case
@grantmcdermott
Copy link
Owner Author

Closing, since the scaffolding for this now exists via par2.

At the moment, only a few global options are supported. I also haven't integrated the forward passing of arguments from par2 on to par. (I like the convenience of this latter idea.) But these features will be added in time.

Please feel free to raise suggestions for the specific par2 parameters/features as separate issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wishlist Features we'd like to support
Projects
None yet
Development

No branches or pull requests

2 participants