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

Is there a way to mimic the style of the default plots from simplevis? #1035

Open
stratust opened this issue Jan 17, 2025 · 7 comments
Open

Comments

@stratust
Copy link

Hi, is there a way to use the set_blanket function to mimic the y and x axis of simplevis package?

Image

@davidhodge931
Copy link
Owner

davidhodge931 commented Jan 20, 2025

You can use weave_theme to make their be no side-effects within the gg_* function. I.e. the theme will be exactly as you set it. This means you can have 2 dark black axis lines etc, if that's what you want.

Image Image

Is this what you mean?

@davidhodge931
Copy link
Owner

To get closer to the simplevis axes above...

I've just made a change to the DEV version, where I allow both 'symmetric' axes - if the *_transform args are NULL and the stat is "identity".

library(ggplot2)
library(palmerpenguins)
library(ggblanket)
library(patchwork)

set_blanket()

weave_theme(
  theme = light_mode_r(),
  )

p1 <- penguins |> 
  gg_point(
    x = flipper_length_mm,
    y = body_mass_g,
    x_symmetric = TRUE,
  )

p2 <- penguins |> 
  gg_path(
    x = flipper_length_mm,
    y = body_mass_g,
    x_symmetric = TRUE,
  ) + 
  theme(panel.grid.major.x = element_blank())

p1 + p2
Image

@davidhodge931
Copy link
Owner

You can also change axes and gridline linewidth and colour in the light_mode_*() function, if that is what you are after

@davidhodge931 davidhodge931 reopened this Jan 21, 2025
@davidhodge931
Copy link
Owner

Related to this
#1039

@stratust
Copy link
Author

Thanks @davidhodge931! I installed the dev branch, and x_symmetric works with gg_* now, but I cannot set it as default using set_blanket(y_symmetric = TRUE, x_symmetric = TRUE) or weave_geom_defaults(y_symmetric = TRUE, x_symmetric = TRUE).

@davidhodge931
Copy link
Owner

I don't think I'll support this, as it won't work across too many gg_* functions or args

FYI - I'm rethinking mode/theme and weave/set_blanket with breaking changes for next version, sorry. You may need to tweak function/argument names in the next version
#1040

@davidhodge931
Copy link
Owner

Done a heap of work on this today to provide more flexibility in the theme magic from the gg_* function... Download from github, and try this... Sorry for any broken code..

library(tidyverse)
library(ggblanket)
library(palmerpenguins)

set_blanket(
  theme = light_mode_r(
    axis_line_linewidth = 1, 
    panel_grid_colour = "lightgrey",
    panel_grid_linewidth = 0.25,
    ),
  theme_axis_line_rm = FALSE,
  theme_axis_ticks_rm = FALSE,
)

penguins |>
  gg_point(
    x = flipper_length_mm,
    y = body_mass_g,
    col = species,
    x_symmetric = TRUE,
  )

penguins |>
  gg_path(
    x = flipper_length_mm,
    y = body_mass_g,
    col = species,
    x_symmetric = TRUE,
  )

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

No branches or pull requests

2 participants