if (!("canvasXpress" %in% installed.packages())) {
devtools::install_github('neuhausi/canvasXpress')
}
#devtools::install_local("~/git/canvas/R/canvasXpress.tar.gz", build_manual = TRUE, upgrade = "always")
library(ggblanket)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.1
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(stringr)
library(tidyr)
library(palmerpenguins)
library(patchwork)
library(canvasXpress)
set_blanket()
p <- penguins |>
gg_histogram(
x = flipper_length_mm,
col = species,
title = "Penguin flipper length by species",
subtitle = "Palmer Archipelago, Antarctica",
caption = "Source: Gorman, 2020",
mode = light_mode_t(),
) +
labs(colour = NULL, fill = NULL)
#p
canvasXpress(p, width = 672, height = 500)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 2 rows containing non-finite outside the scale range
## (`stat_bin()`).
p1 <- penguins |>
gg_point(
x = flipper_length_mm,
y = body_mass_g,
x_breaks = scales::breaks_pretty(3),
) +
geom_vline(xintercept = 200) +
annotate("text", x = I(0.25), y = I(0.75), label = "Here")
p2 <- penguins |>
gg_histogram(
x = flipper_length_mm,
x_breaks = scales::breaks_pretty(3),
) +
geom_vline(xintercept = 200) +
annotate("text", x = I(0.75), y = I(0.75), label = "Here")
p = p1 + p2
#p
canvasXpress(p, width = 672, height = 500)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 2 rows containing non-finite outside the scale range
## (`stat_bin()`).
sessionInfo()
## R version 4.4.0 (2024-04-24)
## Platform: aarch64-apple-darwin20
## Running under: macOS 15.5
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: America/New_York
## tzcode source: internal
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] canvasXpress_1.50.5 patchwork_1.2.0 palmerpenguins_0.1.1
## [4] tidyr_1.3.1 stringr_1.5.1 dplyr_1.1.4
## [7] ggplot2_3.5.2 ggblanket_9.0.0
##
## loaded via a namespace (and not attached):
## [1] gtable_0.3.6 jsonlite_2.0.0 compiler_4.4.0 tidyselect_1.2.1
## [5] snakecase_0.11.1 jquerylib_0.1.4 scales_1.4.0 labelled_2.13.0
## [9] yaml_2.3.10 fastmap_1.2.0 R6_2.6.1 labeling_0.4.3
## [13] generics_0.1.4 knitr_1.50 htmlwidgets_1.6.4 forcats_1.0.0
## [17] tibble_3.3.0 lubridate_1.9.3 bslib_0.9.0 pillar_1.10.2
## [21] RColorBrewer_1.1-3 rlang_1.1.6 cachem_1.1.0 stringi_1.8.7
## [25] xfun_0.52 sass_0.4.10 timechange_0.3.0 viridisLite_0.4.2
## [29] cli_3.6.5 withr_3.0.2 magrittr_2.0.3 digest_0.6.37
## [33] grid_4.4.0 rstudioapi_0.16.0 haven_2.5.4 hms_1.1.3
## [37] lifecycle_1.0.4 vctrs_0.6.5 evaluate_1.0.4 glue_1.8.0
## [41] farver_2.1.2 colorspace_2.1-1 rmarkdown_2.29 purrr_1.0.4
## [45] tools_4.4.0 pkgconfig_2.0.3 htmltools_0.5.8.1