du chaos
This commit is contained in:
parent
a9b8b5f708
commit
5beec7fb90
22 changed files with 782 additions and 171 deletions
|
|
@ -27,7 +27,8 @@ bar(
|
|||
add_text_font_face = "plain",
|
||||
add_text_threshold_display = 0.05,
|
||||
add_text_suffix = "\%",
|
||||
add_text_expand_limit = 1.1
|
||||
add_text_expand_limit = 1.2,
|
||||
add_text_round = 1
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
|
|
@ -76,6 +77,12 @@ bar(
|
|||
\item{add_text_suffix}{If percent is FALSE, should we add a suffix to the text label?}
|
||||
|
||||
\item{add_text_expand_limit}{Default to adding 10% on top of the bar.}
|
||||
|
||||
\item{add_text_round}{Round the text label.}
|
||||
|
||||
\item{theme_fun}{Whatever theme function. For no custom theme, use theme_fun = NULL.}
|
||||
|
||||
\item{scale_impact}{Use the package custom scales for fill and color.}
|
||||
}
|
||||
\description{
|
||||
Simple bar chart
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
\usage{
|
||||
palette_gen(palette, type, direction = 1, ...)
|
||||
|
||||
palette_gen_categorical(palette = "branding_reach", direction = 1)
|
||||
palette_gen_categorical(palette = "cat_5_main", direction = 1)
|
||||
|
||||
palette_gen_sequential(palette = "seq_7_artichoke", direction = 1, ...)
|
||||
palette_gen_sequential(palette = "seq_5_main", direction = 1, ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{palette}{Palette name from [palette()].}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
\alias{scale_fill_visualizer_discrete}
|
||||
\alias{scale_fill_visualizer_continuous}
|
||||
\alias{scale_color_visualizer_continuous}
|
||||
\title{Scale constructors}
|
||||
\title{Scale constructors for fill and colors}
|
||||
\usage{
|
||||
scale_color_visualizer_discrete(
|
||||
palette = "cat_5_main",
|
||||
|
|
@ -45,5 +45,5 @@ scale_color_visualizer_continuous(
|
|||
\item{...}{Additional arguments passed to [ggplot2::discrete_scale()] if discrete or [ggplot2::scale_fill_gradient()] if continuous.}
|
||||
}
|
||||
\description{
|
||||
Scale constructors
|
||||
This function is based on [palette()]. If palette is NULL, the used palette will be magma from gpplot2's viridis scale constructors.
|
||||
}
|
||||
|
|
|
|||
25
man/scale_visualizer_discrete.Rd
Normal file
25
man/scale_visualizer_discrete.Rd
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/scale.R
|
||||
\name{scale_visualizer_discrete}
|
||||
\alias{scale_visualizer_discrete}
|
||||
\title{One scale for all}
|
||||
\usage{
|
||||
scale_visualizer_discrete(
|
||||
palette = "cat_5_main",
|
||||
direction = 1,
|
||||
reverse_guide = TRUE,
|
||||
...
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{palette}{Palette name from [palette()].}
|
||||
|
||||
\item{direction}{1 or -1; should the order of colors be reversed?}
|
||||
|
||||
\item{reverse_guide}{Boolean indicating whether the guide should be reversed.}
|
||||
|
||||
\item{...}{Additional arguments passed to [ggplot2::discrete_scale()] if discrete or [ggplot2::scale_fill_gradient()] if continuous.}
|
||||
}
|
||||
\description{
|
||||
This function is based on [palette()]. If palette is NULL, the used palette will be magma from gpplot2's viridis scale constructors.
|
||||
}
|
||||
14
man/theme_custom.Rd
Normal file
14
man/theme_custom.Rd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/theme_bar.R
|
||||
\name{theme_custom}
|
||||
\alias{theme_custom}
|
||||
\title{Custom Theme}
|
||||
\usage{
|
||||
theme_custom()
|
||||
}
|
||||
\value{
|
||||
A custom theme object.
|
||||
}
|
||||
\description{
|
||||
Create a custom theme for ggplot2.
|
||||
}
|
||||
16
man/theme_visualizer.Rd
Normal file
16
man/theme_visualizer.Rd
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/theme_visualizer_bar.R
|
||||
\docType{data}
|
||||
\name{ThemeVisualizerBar}
|
||||
\alias{ThemeVisualizerBar}
|
||||
\title{ggplot2 theme for bar charts with sane defaults}
|
||||
\format{
|
||||
An object of class \code{ThemeVisualizerBar} (inherits from \code{ggproto}, \code{gg}) of length 1.
|
||||
}
|
||||
\usage{
|
||||
ThemeVisualizerBar
|
||||
}
|
||||
\description{
|
||||
ggplot2 theme for bar charts with sane defaults
|
||||
}
|
||||
\keyword{datasets}
|
||||
33
man/theme_visualizer_bar.Rd
Normal file
33
man/theme_visualizer_bar.Rd
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/theme_visualizer_bar.R
|
||||
\name{theme_visualizer_bar}
|
||||
\alias{theme_visualizer_bar}
|
||||
\title{Dynamic Theme for ggplot2}
|
||||
\usage{
|
||||
theme_visualizer_bar()
|
||||
}
|
||||
\value{
|
||||
A ggproto object that applies a dynamic theme to a ggplot2 plot.
|
||||
}
|
||||
\description{
|
||||
A dynamic theme that adjusts axis text styles based on whether the plot is flipped.
|
||||
}
|
||||
\details{
|
||||
This function dynamically applies different axis text styles depending on
|
||||
the coordinate system of the plot. If the plot is flipped (e.g., using
|
||||
`coord_flip()`), the x-axis and y-axis text styles are adjusted accordingly.
|
||||
}
|
||||
\examples{
|
||||
library(ggplot2)
|
||||
|
||||
# Example with a regular plot
|
||||
p <- ggplot(mpg, aes(displ, hwy)) +
|
||||
geom_col()
|
||||
|
||||
# Add the dynamic theme
|
||||
p + theme_visualizer_bar()
|
||||
|
||||
# Add the dynamic theme with a flipped coordinate system
|
||||
p + theme_visualizer_bar() + coord_flip()
|
||||
|
||||
}
|
||||
|
|
@ -1,28 +1,31 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/theme.R
|
||||
\name{theme_reach}
|
||||
\alias{theme_reach}
|
||||
\title{ggplot2 theme wrapper with REACH fonts and colors}
|
||||
\name{theme_visualizer_default}
|
||||
\alias{theme_visualizer_default}
|
||||
\title{ggplot2 theme wrapper with fonts and colors}
|
||||
\usage{
|
||||
theme_reach(
|
||||
theme_visualizer_default(
|
||||
font_family = "Carlito",
|
||||
title_size = 16,
|
||||
title_size = 14,
|
||||
title_color = color("dark_grey"),
|
||||
title_font_face = "bold",
|
||||
title_hjust = NULL,
|
||||
title_position_to_plot = TRUE,
|
||||
title_font_family = "Carlito",
|
||||
text_size = 14,
|
||||
subtitle_size = 13,
|
||||
subtitle_font_face = "plain",
|
||||
subtitle_font_family = "Carlito",
|
||||
text_size = 12,
|
||||
text_color = color("dark_grey"),
|
||||
text_font_face = "plain",
|
||||
panel_background_color = "#FFFFFF",
|
||||
panel_border = FALSE,
|
||||
panel_border_color = color("dark_grey"),
|
||||
legend_position = "bottom",
|
||||
legend_position = "top",
|
||||
legend_direction = "horizontal",
|
||||
legend_justification = "left",
|
||||
legend_justification = "center",
|
||||
legend_reverse = TRUE,
|
||||
legend_title_size = 14,
|
||||
legend_title_size = 12,
|
||||
legend_title_color = color("dark_grey"),
|
||||
legend_title_font_face = "plain",
|
||||
legend_text_size = 12,
|
||||
|
|
@ -36,7 +39,7 @@ theme_reach(
|
|||
axis_text_y = TRUE,
|
||||
axis_line_y = TRUE,
|
||||
axis_ticks_y = TRUE,
|
||||
axis_text_size = 14,
|
||||
axis_text_size = 12,
|
||||
axis_text_color = color("dark_grey"),
|
||||
axis_text_font_face = "plain",
|
||||
axis_title_size = 15,
|
||||
|
|
@ -47,15 +50,17 @@ theme_reach(
|
|||
axis_text_x_hjust = 0.5,
|
||||
grid_major_x = TRUE,
|
||||
grid_major_y = FALSE,
|
||||
grid_major_color = color("light_grey"),
|
||||
grid_major_x_size = 0.01,
|
||||
grid_major_y_size = 0.01,
|
||||
grid_major_color = color("dark_grey"),
|
||||
grid_major_x_size = 0.1,
|
||||
grid_major_y_size = 0.1,
|
||||
grid_minor_x = FALSE,
|
||||
grid_minor_y = FALSE,
|
||||
grid_minor_color = color("light_grey"),
|
||||
grid_minor_x_size = 0.005,
|
||||
grid_minor_y_size = 0.005,
|
||||
grid_minor_color = color("dark_grey"),
|
||||
grid_minor_x_size = 0.05,
|
||||
grid_minor_y_size = 0.05,
|
||||
caption_position_to_plot = TRUE,
|
||||
caption_text_size = 10,
|
||||
caption_text_color = color("dark_grey"),
|
||||
...
|
||||
)
|
||||
}
|
||||
|
|
@ -163,6 +168,8 @@ theme_reach(
|
|||
\item{caption_position_to_plot}{TRUE or FALSE. Positioning to plot or to panel?}
|
||||
|
||||
\item{...}{Additional arguments passed to [ggplot2::theme()].}
|
||||
|
||||
\item{p}{A ggplot2 object.}
|
||||
}
|
||||
\description{
|
||||
Give some reach colors and fonts to a ggplot.
|
||||
Loading…
Add table
Add a link
Reference in a new issue