neuhausi / canvasXpress

CanvasXpress: A JavaScript Library for Data Analytics with Full Audit Trail Capabilities.
http://www.canvasXpress.org
290 stars 44 forks source link

Could canvasXpress respect `ggplot2::update_geom_defaults`? #155

Closed davidhodge931 closed 5 months ago

davidhodge931 commented 6 months ago

ggplot2::update_geom_defaults enables users to set default aesthetics for when an aesthetic variable is not set.

This is super useful for typing less.

I use these functions in ggblanket with a set_blanket function which sets default colour, fill, alpha and linewidth.

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

update_geom_defaults("boxplot",
                     aes(colour = "red", 
                         fill = "blue". 
                         alpha = 0.5, 
                         linewidth = 0.66)
                     )

p <- penguins |> 
  ggplot(aes(x = species, y = body_mass_g)) +
  geom_boxplot() 

p

canvasXpress::canvasXpress(p)
neuhausi commented 6 months ago

Those properties are not in the ggplot object. Where do you store them?

davidhodge931 commented 6 months ago

Each geom has its defaults stored in it's ggproto object.

E.g. ggplot2::GeomBoxplot$default_aes

neuhausi commented 5 months ago

Fixed in 49.1 cX-htmlwidget-e1346e02e5ae200a2fa2-cx