### Install Paletteer Package Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Instructions for installing the paletteer package from CRAN or the development version from GitHub. ```r install.packages("paletteer") devtools::install_github("EmilHvitfeldt/paletteer") ``` -------------------------------- ### Access and Inspect Discrete Palettes (R) Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Provides examples of accessing specific discrete color palettes from the `palettes_d` nested list structure. It shows how to retrieve colors for a given palette, list available packages, list palettes within a package, and get the number of colors in a palette. ```r library(paletteer) # Access palette directly palettes_d[["nord"]][["frost"]] # List available packages names(palettes_d) # List palettes in a package names(palettes_d[["wesanderson"]]) # Get palette length length(palettes_d[["ghibli"]][["SpiritedMedium"]]) ``` -------------------------------- ### Install paletteer Package in R Source: https://github.com/emilhvitfeldt/paletteer/blob/main/README.md Demonstrates how to install the paletteer package from CRAN and the development version from GitHub. It requires the 'devtools' package for GitHub installation. ```r install.packages("paletteer") ``` ```r # install.packages("devtools") devtools::install_github("EmilHvitfeldt/paletteer") ``` -------------------------------- ### View and Filter Dynamic Palette Names (R) Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Demonstrates how to view and filter the `palettes_dynamic_names` data frame to find dynamic palettes. Examples include listing all dynamic palettes, finding unique contributing packages, and filtering by the number of colors supported. ```r library(paletteer) # View dynamic palette names palettes_dynamic_names # Available packages with dynamic palettes unique(palettes_dynamic_names$package) # Find palettes supporting many colors palettes_dynamic_names[palettes_dynamic_names$length >= 15, ] ``` -------------------------------- ### R: Error in spatialLIBD add_images example Source: https://github.com/emilhvitfeldt/paletteer/blob/main/revdep/problems.md This snippet shows an error occurring during the execution of an example for the 'add_images' function in the spatialLIBD R package. The error is related to loading data from a file path, likely due to issues with the BiocFileCache or the data file itself. ```R Running examples in ‘spatialLIBD-Ex.R’ failed The error most likely occurred in: > ### Name: add_images > ### Title: Add non-standard images with the same dimensions as current ones > ### Aliases: add_images > > ### ** Examples > > if (enough_ram()) { ... + spe, + image_id_current = "lowres", + image_id = "lowres_aws", + image_paths = c("151507" = "https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_tissue_lowres_image.png") + )) + } 2026-01-07 11:11:12.444503 loading file /Users/emilhvitfeldt/Library/Caches/org.R-project.R/R/BiocFileCache/b4b51b7c4828_Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata%3Fdl%3D1 Error in load(file_path, verbose = FALSE) : error reading from connection Calls: fetch_data ... sce_to_spe -> check_sce -> stopifnot -> is -> fetch_data -> load Execution halted ``` -------------------------------- ### View Package Information (R) Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Demonstrates how to access and filter the `paletteer_packages` data frame, which contains metadata about contributing packages. Examples include viewing package information, finding packages available on CRAN, and counting the total number of contributing packages. ```r library(paletteer) # View package information head(paletteer_packages) # Find packages available on CRAN cran_packages <- paletteer_packages[paletteer_packages$CRAN == TRUE, ] nrow(cran_packages) # Count total contributing packages nrow(paletteer_packages) ``` -------------------------------- ### View and Filter Discrete Palette Names (R) Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Demonstrates how to view, count, filter, and search for discrete palettes using the `palettes_d_names` data frame. It shows examples of filtering by type, number of colors, and searching by name. ```r library(paletteer) # View all discrete palette names head(palettes_d_names) # Count palettes by package table(palettes_d_names$package) # Filter sequential palettes sequential_palettes <- palettes_d_names[palettes_d_names$type == "sequential", ] nrow(sequential_palettes) # Find palettes with at least 10 colors large_palettes <- palettes_d_names[palettes_d_names$length >= 10, ] head(large_palettes) # Search for specific palette palettes_d_names[grep("frost", palettes_d_names$palette, ignore.case = TRUE), ] ``` -------------------------------- ### View and Filter Continuous Palette Names (R) Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Shows how to access and filter the `palettes_c_names` data frame to find continuous palettes. Examples include viewing names, counting by package, filtering by type, and searching for specific palettes. ```r library(paletteer) # View continuous palette names head(palettes_c_names) # Count by package table(palettes_c_names$package) # Find diverging continuous palettes diverging <- palettes_c_names[palettes_c_names$type == "diverging", ] head(diverging) # Search for specific continuous palette palettes_c_names[grep("berlin", palettes_c_names$palette, ignore.case = TRUE), ] ``` -------------------------------- ### Validate paletteer_dynamic arguments Source: https://github.com/emilhvitfeldt/paletteer/blob/main/tests/testthat/_snaps/paletteer_dynamic.md Demonstrates error handling for missing or out-of-bounds parameters in the paletteer_dynamic function. These examples show how the function enforces constraints on the number of colors and the direction parameter. ```R # Error when n is missing paletteer_dynamic("ggthemes_solarized::green") # Error when n exceeds palette capacity paletteer_dynamic("ggthemes_solarized::green", 100) # Error when direction is invalid paletteer_dynamic("ggthemes_solarized::green", 3, direction = 10) ``` -------------------------------- ### Access and Inspect Dynamic Palettes (R) Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Illustrates how to access dynamic color palettes from the `palettes_dynamic` nested list at specific color counts. It shows retrieving a palette at a given length, accessing the same palette at a different length, and listing available dynamic palette packages. ```r library(paletteer) # Access dynamic palette at specific length palettes_dynamic[["cartography"]][["green.pal"]][[5]] # Same palette at different length palettes_dynamic[["cartography"]][["green.pal"]][[3]] # List available dynamic palette packages names(palettes_dynamic) ``` -------------------------------- ### Update Palette Selection Syntax in paletteer Source: https://github.com/emilhvitfeldt/paletteer/blob/main/README.md Illustrates the change in palette selection syntax from older versions of paletteer (<= 0.2.1) to the current version. The older syntax used separate 'package' and 'palette' arguments, while the newer syntax uses a single string 'packagename::palettename'. ```r # Older syntax (<= 0.2.1) # paletteer_c(package = "nord", palette = "frost") # Current syntax (> 0.2.1) paletteer_c("nord::frost") ``` -------------------------------- ### Paletteer Core Functions Source: https://github.com/emilhvitfeldt/paletteer/blob/main/README.md Demonstrates the usage of paletteer's core functions for accessing different types of color palettes. ```APIDOC ## Paletteer Core Functions ### Description These functions provide a unified interface to access discrete, continuous, and dynamic color palettes from various R packages. ### Functions #### `paletteer_c(palette, n)` - **Description**: Retrieves a continuous color palette. - **Parameters**: - `palette` (string) - Required - The name of the palette in the format "packagename::palettename". - `n` (integer) - Optional - The number of colors to generate. Defaults to the palette's natural number of colors. #### `paletteer_d(palette, n)` - **Description**: Retrieves a discrete color palette. - **Parameters**: - `palette` (string) - Required - The name of the palette in the format "packagename::palettename". - `n` (integer) - Optional - The number of colors to retrieve. Defaults to the palette's natural number of colors. #### `paletteer_dynamic(palette, n)` - **Description**: Retrieves a dynamic color palette where the number of colors can vary. - **Parameters**: - `palette` (string) - Required - The name of the palette in the format "packagename::palettename". - `n` (integer) - Required - The number of colors to generate. ### Request Example ```r # Continuous palette paletteer_c("scico::berlin", n = 10) # Discrete palette paletteer_d("nord::frost") # Dynamic palette paletteer_dynamic("cartography::green.pal", 5) ``` ### Response Example ```r # Example output for paletteer_c("scico::berlin", n = 10): # # #9EB0FFFF #5AA3DAFF #2D7597FF #194155FF #11181DFF #270C01FF #501802FF #8A3F2AFF #C37469FF #FFACACFF # Example output for paletteer_d("nord::frost"): # # #8FBCBBFF #88C0D0FF #81A1C1FF #5E81ACFF # Example output for paletteer_dynamic("cartography::green.pal", 5): # # #B8D9A9FF #8DBC80FF #5D9D52FF #287A22FF #17692CFF ``` ``` -------------------------------- ### Access Color Palettes with paletteer Functions Source: https://github.com/emilhvitfeldt/paletteer/blob/main/README.md Shows how to use the core paletteer functions (paletteer_c, paletteer_d, paletteer_dynamic) to retrieve continuous, discrete, and dynamic color palettes. Palettes are specified using the 'packagename::palettename' syntax. ```r paletteer_c("scico::berlin", n = 10) #> #> #9EB0FFFF #5AA3DAFF #2D7597FF #194155FF #11181DFF #270C01FF #501802FF #8A3F2AFF #C37469FF #FFACACFF ``` ```r paletteer_d("nord::frost") #> #> #8FBCBBFF #88C0D0FF #81A1C1FF #5E81ACFF ``` ```r paletteer_dynamic("cartography::green.pal", 5) #> #> #B8D9A9FF #8DBC80FF #5D9D52FF #287A22FF #17692CFF ``` -------------------------------- ### Binned Fill Scales with paletteer Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Applies continuous palettes as binned fill scales for stepped color representation in filled geometries. Supports various palette sources. ```r library(ggplot2) library(paletteer) # Binned fill for density ggplot(faithfuld, aes(x = waiting, y = eruptions, fill = density)) + geom_tile() + scale_fill_paletteer_binned("scico::lajolla") # Contour plot with binned fill ggplot(faithfuld, aes(x = waiting, y = eruptions, z = density)) + geom_contour_filled() + scale_fill_paletteer_binned("viridis::mako") ``` -------------------------------- ### Define Continuous Palette Wrapper Source: https://github.com/emilhvitfeldt/paletteer/blob/main/CONTRIBUTING.md Template for creating a wrapper function for continuous palettes. The function must accept 'name' and 'n' arguments and return the generated color palette. ```R paletteer_c_ <- function(name, n) { # Implementation logic pal_gen(n = n) } ``` -------------------------------- ### Binned Color Scales with paletteer Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Applies continuous palettes as binned/stepped color scales for discrete color bands with continuous data. Supports various palette sources and options like custom breaks and reversed direction. ```r library(ggplot2) library(paletteer) # Binned color scale ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, colour = Petal.Length)) + geom_point(size = 3) + scale_colour_paletteer_binned("scico::tokyo") # Custom bin breaks ggplot(mtcars, aes(x = wt, y = mpg, colour = hp)) + geom_point(size = 4) + scale_color_paletteer_binned("viridis::viridis", breaks = c(100, 150, 200, 250)) # Reversed binned scale ggplot(diamonds[1:5000, ], aes(x = carat, y = price, colour = depth)) + geom_point(alpha = 0.5) + scale_colour_paletteer_binned("grDevices::Blues 3", direction = -1) ``` -------------------------------- ### Generate Continuous Palettes Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Creates smooth color gradients for continuous numeric data. Requires specifying the number of colors (n) and supports direction reversal. ```r library(paletteer) paletteer_c("scico::berlin", n = 10) paletteer_c("viridis::viridis", n = 100) paletteer_c("scico::tokyo", n = 50, direction = -1) ``` -------------------------------- ### Palette Information Source: https://github.com/emilhvitfeldt/paletteer/blob/main/README.md Accessing metadata about the available palettes within the paletteer package. ```APIDOC ## Palette Information ### Description Paletteer provides data frames that contain information about all the palettes included in the package. ### Data Frames #### `palettes_c_names` - **Description**: Contains information about continuous palettes. #### `palettes_d_names` - **Description**: Contains information about discrete palettes. #### `palettes_dynamic_names` - **Description**: Contains information about dynamic palettes. ### Request Example ```r # View names of continuous palettes head(palettes_c_names) # View names of discrete palettes head(palettes_d_names) # View names of dynamic palettes head(palettes_dynamic_names) ``` ### Response Example (The response will be the first few rows of the respective data frames, showing palette names, package sources, and other relevant metadata.) ``` -------------------------------- ### Validate direction parameter in scale_colour_paletteer_d Source: https://github.com/emilhvitfeldt/paletteer/blob/main/tests/testthat/_snaps/ggplot2_scales_discrete.md Demonstrates the usage of the direction parameter within the scale_colour_paletteer_d function. Note that providing a value other than 1 or -1 will trigger an error. ```R ggplot2::ggplot(df, ggplot2::aes(x, y, colour = color)) + scale_colour_paletteer_d("nord::lumina", direction = 1) ``` -------------------------------- ### Access Dynamic Palettes Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Retrieves palettes that adapt their color selection based on the number of requested colors, useful for varying data cardinality. ```r library(paletteer) paletteer_dynamic("cartography::green.pal", 5) paletteer_dynamic("cartography::green.pal", 10) paletteer_dynamic("cartography::sand.pal", 20, direction = -1) ``` -------------------------------- ### Integrate paletteer with ggplot2 Scales Source: https://github.com/emilhvitfeldt/paletteer/blob/main/README.md Demonstrates how to use paletteer's ggplot2 scales, specifically 'scale_color_paletteer_d', to apply discrete color palettes to plots. This requires the ggplot2 package to be loaded. ```r library(ggplot2) ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point() + scale_color_paletteer_d("nord::aurora") ``` -------------------------------- ### ggplot2 Scales Source: https://github.com/emilhvitfeldt/paletteer/blob/main/README.md Shows how to integrate paletteer palettes with ggplot2 visualizations using custom scales. ```APIDOC ## ggplot2 Scales ### Description Paletteer provides custom scales for `ggplot2` that allow you to easily apply palettes from the package to your plots. ### Functions #### `scale_color_paletteer_d(palette, ...)` - **Description**: A discrete color scale for `ggplot2` using a paletteer palette. - **Parameters**: - `palette` (string) - Required - The name of the palette in the format "packagename::palettename". - `...` - Additional arguments passed to `ggplot2::discrete_scale`. #### `scale_fill_paletteer_d(palette, ...)` - **Description**: A discrete fill scale for `ggplot2` using a paletteer palette. - **Parameters**: - `palette` (string) - Required - The name of the palette in the format "packagename::palettename". - `...` - Additional arguments passed to `ggplot2::discrete_scale`. ### Request Example ```r library(ggplot2) ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point() + scale_color_paletteer_d("nord::aurora") ``` ### Response Example (The response is a `ggplot2` plot with points colored according to the specified palette.) ![ggplot2 plot with nord::aurora palette](man/figures/README-unnamed-chunk-6-1.png) ``` -------------------------------- ### Discrete Color Scales with paletteer Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Applies discrete palettes to ggplot2 color aesthetics for categorical data. Supports various palette sources and options like dynamic scaling and direction reversal. ```r library(ggplot2) library(paletteer) # Using wesanderson palette ggplot(mtcars, aes(x = wt, y = mpg, colour = factor(cyl))) + geom_point(size = 4) + scale_color_paletteer_d("wesanderson::Darjeeling1") + theme_minimal() # Use dynamic palette for discrete scale ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, colour = Species)) + geom_point(size = 3) + scale_colour_paletteer_d("cartography::green.pal", dynamic = TRUE) # Reverse palette direction ggplot(diamonds[1:1000, ], aes(x = carat, y = price, colour = cut)) + geom_point(alpha = 0.7) + scale_colour_paletteer_d("ghibli::MarnieMedium1", direction = -1) ``` -------------------------------- ### R: Vignette 'TenX_data_download.Rmd' download error Source: https://github.com/emilhvitfeldt/paletteer/blob/main/revdep/problems.md This snippet illustrates an error encountered while running the 'TenX_data_download.Rmd' vignette for the spatialLIBD R package. The failure is attributed to a download error from an FTP URL, specifically when trying to add a remote file to the BiocFileCache. ```R when running code in ‘TenX_data_download.R’ ... rid: BFC19 fpath: ‘ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_32/gencode.v32.annotation.gtf.gz’ reason: download failed Warning in value[[3L]](cond) : trying to add rname 'ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_32/gencode.v32.annotation.gtf.gz' produced error: bfcadd() failed; see warnings() When sourcing ‘TenX_data_download.R’: Error: not all 'rnames' found or unique. Execution halted ``` -------------------------------- ### paletteer_d: Handle incorrect palette names Source: https://github.com/emilhvitfeldt/paletteer/blob/main/tests/testthat/_snaps/paletteer_d.md Shows how paletteer_d handles errors when a non-existent palette name is provided. The function expects palettes in the format 'package::palette' and will return an error if not found. ```R paletteer_d("paletteer::notreal") ``` -------------------------------- ### Discrete Fill Scales with paletteer Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Applies discrete palettes to ggplot2 fill aesthetics for bar charts, histograms, and other filled geometries. Supports various palette sources and options like dynamic scaling. ```r library(ggplot2) library(paletteer) # Bar chart with discrete fill ggplot(mpg, aes(x = class, fill = class)) + geom_bar() + scale_fill_paletteer_d("dutchmasters::milkmaid") + theme_minimal() + theme(legend.position = "none") # Stacked bar chart ggplot(diamonds, aes(x = cut, fill = clarity)) + geom_bar(position = "stack") + scale_fill_paletteer_d("RColorBrewer::Set3") # Box plot with Ghibli palette ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) + geom_boxplot() + scale_fill_paletteer_d("ghibli::PonyoMedium") + theme_classic() # Dynamic palette for fill ggplot(mpg, aes(x = manufacturer, fill = manufacturer)) + geom_bar() + scale_fill_paletteer_d("ggthemes_solarized::magenta", dynamic = TRUE) + coord_flip() + theme(legend.position = "none") ``` -------------------------------- ### Retrieve Discrete Palettes Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Retrieves categorical palettes with fixed color counts. Supports subsetting, reversing direction, and interpolation to continuous scales. ```r library(paletteer) paletteer_d("nord::frost") paletteer_d("wesanderson::Royal1", 3) paletteer_d("nord::aurora", direction = -1) paletteer_d("Redmonder::dPBIPuOr", 14, type = "continuous") ``` -------------------------------- ### Define Discrete Palette Structure Source: https://github.com/emilhvitfeldt/paletteer/blob/main/CONTRIBUTING.md Template for defining a new discrete palette in the R package. It requires creating a named list of palettes and registering them in the master palettes_d list. ```R ## _pals <- list( palette_name = c("#hex1", "#hex2") ) # Add to palettes_d list at the end of data-raw/palettes_d.R ``` -------------------------------- ### Validate 'direction' argument in paletteer_c (R) Source: https://github.com/emilhvitfeldt/paletteer/blob/main/tests/testthat/_snaps/paletteer_c.md Illustrates the error when 'direction' is set to an invalid value in paletteer_c. The 'direction' argument must be either 1 or -1. ```r paletteer_c("grDevices::rainbow", 3, direction = 10) ``` -------------------------------- ### Continuous Color Scales with paletteer Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Applies continuous palettes to ggplot2 color aesthetics for numeric data, creating smooth color gradients. Supports various palette sources and options like reversed direction. ```r library(ggplot2) library(paletteer) # Continuous color scale for numeric variable ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, colour = Petal.Length)) + geom_point(size = 3) + scale_colour_paletteer_c("scico::tokyo") # Viridis continuous scale ggplot(faithfuld, aes(x = waiting, y = eruptions, colour = density)) + geom_point(size = 2) + scale_color_paletteer_c("viridis::plasma") # Reversed continuous scale ggplot(mtcars, aes(x = wt, y = mpg, colour = hp)) + geom_point(size = 4) + scale_colour_paletteer_c("grDevices::Zissou 1", direction = -1) + theme_minimal() # Density plot with continuous color ggplot(diamonds, aes(x = carat, y = price, colour = depth)) + geom_point(alpha = 0.3, size = 1) + scale_colour_paletteer_c("pals::ocean.haline") + theme_dark() ``` -------------------------------- ### Validate 'n' argument in paletteer_c (R) Source: https://github.com/emilhvitfeldt/paletteer/blob/main/tests/testthat/_snaps/paletteer_c.md Demonstrates the error raised when the 'n' argument is not specified in paletteer_c. The function requires 'n' to be a whole number. ```r paletteer_c("grDevices::rainbow") ``` -------------------------------- ### paletteer_d: Validate 'direction' parameter Source: https://github.com/emilhvitfeldt/paletteer/blob/main/tests/testthat/_snaps/paletteer_d.md Illustrates the error handling for the 'direction' parameter in paletteer_d when an invalid value is provided. The function requires 'direction' to be either 1 or -1. ```R paletteer_d("wesanderson::Royal1", 3, direction = 10) ``` -------------------------------- ### Continuous Fill Scales with paletteer Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Applies continuous palettes to ggplot2 fill aesthetics for heatmaps, density plots, and contour fills. Supports various palette sources and options like reversed direction. ```r library(ggplot2) library(paletteer) # Heatmap with continuous fill ggplot(faithfuld, aes(x = waiting, y = eruptions, fill = density)) + geom_tile() + scale_fill_paletteer_c("viridis::inferno") # Density 2D plot ggplot(diamonds, aes(x = carat, y = price)) + stat_density_2d(aes(fill = after_stat(density)), geom = "raster", contour = FALSE) + scale_fill_paletteer_c("scico::bilbao") + coord_cartesian(expand = FALSE) # Contour fill plot ggplot(faithfuld, aes(x = waiting, y = eruptions, z = density)) + geom_contour_filled() + scale_fill_paletteer_c("grDevices::Spectral", direction = -1) # Tile plot with reversed palette ggplot(data.frame(x = 1:10, y = 1:10, z = runif(100)), aes(x = x, y = y, fill = z)) + geom_tile() + scale_fill_paletteer_c("scico::roma", direction = -1) ``` -------------------------------- ### Apply Discrete ggplot2 Color Scales Source: https://context7.com/emilhvitfeldt/paletteer/llms.txt Integrates paletteer with ggplot2 to apply discrete color scales to categorical data aesthetics. ```r library(ggplot2) library(paletteer) ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, colour = Species)) + geom_point(size = 3) + scale_colour_paletteer_d("nord::aurora") ``` -------------------------------- ### Validate direction parameter in scale_colour_paletteer_binned Source: https://github.com/emilhvitfeldt/paletteer/blob/main/tests/testthat/_snaps/ggplot2_scales_binned.md Demonstrates the usage of the scale_colour_paletteer_binned function within a ggplot2 workflow. It highlights that the direction argument is strictly limited to values of 1 or -1, and providing other integers will result in an error. ```R ggplot2::ggplot(df, ggplot2::aes(x, y, colour = color)) + scale_colour_paletteer_binned("scico::berlin", direction = 1) ``` -------------------------------- ### paletteer_d: Validate 'n' parameter Source: https://github.com/emilhvitfeldt/paletteer/blob/main/tests/testthat/_snaps/paletteer_d.md Demonstrates the error handling for the 'n' parameter in paletteer_d when an invalid number of colors is requested. The function expects 'n' to be a whole number within a specific range. ```R paletteer_d("wesanderson::Royal1", 100) ``` -------------------------------- ### scale_colour_paletteer_binned Source: https://github.com/emilhvitfeldt/paletteer/blob/main/tests/testthat/_snaps/ggplot2_scales_binned.md Applies a binned color scale to a ggplot2 object using a specified palette and direction. ```APIDOC ## GET scale_colour_paletteer_binned ### Description Applies a binned color scale to a ggplot2 plot using a palette from the paletteer collection. Validates that the direction parameter is restricted to 1 or -1. ### Method Function Call ### Endpoint scale_colour_paletteer_binned(palette, direction) ### Parameters #### Arguments - **palette** (string) - Required - The name of the palette to use (e.g., "scico::berlin"). - **direction** (integer) - Optional - The direction of the color scale. Must be 1 (default) or -1. ### Request Example ```r ggplot2::ggplot(df, ggplot2::aes(x, y, colour = color)) + scale_colour_paletteer_binned("scico::berlin", direction = 1) ``` ### Response #### Error Response (400) - **error** (string) - Returns an error if direction is not 1 or -1, e.g., "! `direction` must be 1 or -1, not 10." ``` -------------------------------- ### Correct ggplot2 paletteer Continuous Color Scale Source: https://github.com/emilhvitfeldt/paletteer/blob/main/tests/testthat/_snaps/ggplot2_scales_continuous.md This snippet shows the correct way to use a paletteer continuous color scale with ggplot2. It maps a variable 'color' to a continuous scale from the 'scico::berlin' palette. The 'direction' argument is not explicitly set, defaulting to the correct value. ```r ggplot2::ggplot(df, ggplot2::aes(x, y, colour = color)) + scale_colour_paletteer_c("scico::berlin") ``` -------------------------------- ### Incorrect ggplot2 paletteer Continuous Color Scale Direction Source: https://github.com/emilhvitfeldt/paletteer/blob/main/tests/testthat/_snaps/ggplot2_scales_continuous.md This snippet demonstrates an incorrect usage of a paletteer continuous color scale in ggplot2. The 'direction' argument is set to an invalid value (10), which should only be 1 or -1. This will result in an error. ```r ggplot2::ggplot(df, ggplot2::aes(x, y, colour = color)) + scale_colour_paletteer_c("scico::berlin", direction = 10) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.