Fix R CMD checks and update README

This commit is contained in:
gnoblet 2025-07-03 11:52:39 +02:00
parent 0aae59491e
commit 6b508150a7
33 changed files with 498 additions and 368 deletions

View file

@ -52,6 +52,8 @@ bar(
)
}
\arguments{
\item{...}{Additional arguments passed to `bar()`}
\item{flip}{TRUE or FALSE (default). Default to TRUE or horizontal bar plot.}
\item{add_text}{TRUE or FALSE. Add values as text.}
@ -117,6 +119,10 @@ bar(
\item{add_text_expand_limit}{Default to adding 10\% on top of the bar.}
\item{add_text_round}{Round the text label.}
\item{scale_fill_fun}{Scale fill function. Default to scale_fill_visualizer_discrete().}
\item{scale_color_fun}{Scale color function. Default to scale_color_visualizer_discrete().}
}
\description{
`bar()` is a simple bar chart with some customization allowed, in particular the `theme_fun` argument for theming. `hbar()` uses `bar()` with sane defaults for a horizontal bar chart.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 193 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 146 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 249 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 336 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 182 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 183 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 KiB

After

Width:  |  Height:  |  Size: 402 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 856 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 447 KiB

Before After
Before After

View file

@ -0,0 +1,19 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/internals.R
\name{\%notallin\%}
\alias{\%notallin\%}
\title{Not All In Operator}
\usage{
a \%notallin\% b
}
\arguments{
\item{a}{Vector to test}
\item{b}{Vector to test against}
}
\value{
TRUE if at least one element of `a` is not in `b`, otherwise FALSE
}
\description{
Tests if not all elements of `a` are contained in `b`.
}

View file

@ -0,0 +1,19 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/internals.R
\name{\%notin\%}
\alias{\%notin\%}
\title{Not In Operator}
\usage{
a \%notin\% b
}
\arguments{
\item{a}{Vector or value to test}
\item{b}{Vector to test against}
}
\value{
Logical vector with TRUE for elements of `a` that are not in `b`
}
\description{
A negation of the `%in%` operator that tests if elements of `a` are not in `b`.
}

119
man/lollipop.Rd Normal file
View file

@ -0,0 +1,119 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lollipop.R
\name{hlollipop}
\alias{hlollipop}
\alias{lollipop}
\title{Simple lollipop chart}
\usage{
hlollipop(..., flip = TRUE, theme_fun = theme_lollipop(flip = flip))
lollipop(
df,
x,
y,
group = "",
facet = "",
order = "y",
x_rm_na = TRUE,
y_rm_na = TRUE,
group_rm_na = TRUE,
facet_rm_na = TRUE,
y_expand = 0.1,
add_color = color("cat_5_main_1"),
add_color_guide = TRUE,
flip = FALSE,
wrap = NULL,
alpha = 1,
x_title = NULL,
y_title = NULL,
group_title = NULL,
title = NULL,
subtitle = NULL,
caption = NULL,
dot_size = 4,
line_size = 0.8,
line_color = color("dark_grey"),
dodge_width = 0.9,
theme_fun = theme_lollipop(flip = flip, axis_text_x_angle = 0, axis_text_x_vjust = 0.5,
axis_text_x_hjust = 0.5),
scale_fill_fun = scale_fill_visualizer_discrete(),
scale_color_fun = scale_color_visualizer_discrete()
)
}
\arguments{
\item{...}{Additional arguments passed to `lollipop()`}
\item{flip}{TRUE or FALSE (default). Default to TRUE or horizontal lollipop plot.}
\item{theme_fun}{Whatever theme function. For no custom theme, use theme_fun = NULL.}
\item{df}{A data frame.}
\item{x}{A quoted character column or coercible as a character column.}
\item{y}{A quoted numeric column.}
\item{group}{Some quoted grouping categorical column, e.g. administrative areas or population groups.}
\item{facet}{Some quoted grouping categorical column, e.g. administrative areas or population groups.}
\item{order}{A character scalar specifying the order type (one of "none", "y", "grouped"). See details.}
\item{x_rm_na}{Remove NAs in x?}
\item{y_rm_na}{Remove NAs in y?}
\item{group_rm_na}{Remove NAs in group?}
\item{facet_rm_na}{Remove NAs in facet?}
\item{y_expand}{Multiplier to expand the y axis.}
\item{add_color}{Add a color to dots (if no grouping).}
\item{add_color_guide}{Should a legend be added?}
\item{wrap}{Should x-labels be wrapped? Number of characters.}
\item{alpha}{Fill transparency for dots.}
\item{x_title}{The x scale title. Default to NULL.}
\item{y_title}{The y scale title. Default to NULL.}
\item{group_title}{The group legend title. Default to NULL.}
\item{title}{Plot title. Default to NULL.}
\item{subtitle}{Plot subtitle. Default to NULL.}
\item{caption}{Plot caption. Default to NULL.}
\item{dot_size}{The size of the dots.}
\item{line_size}{The size/width of the line connecting dots to the baseline.}
\item{line_color}{The color of the line connecting dots to the baseline.}
\item{dodge_width}{Width for position dodge when using groups (controls space between grouped lollipops).}
\item{scale_fill_fun}{Scale fill function. Default to scale_fill_visualizer_discrete().}
\item{scale_color_fun}{Scale color function. Default to scale_color_visualizer_discrete().}
}
\value{
A ggplot object
}
\description{
`lollipop()` is a simple lollipop chart (dots connected to the baseline by a segment) with some customization allowed.
`hlollipop()` uses `lollipop()` with sane defaults for a horizontal lollipop chart.
}
\examples{
\dontrun{
df <- data.frame(x = letters[1:5], y = c(10, 5, 7, 12, 8))
# Vertical lollipop
lollipop(df, "x", "y")
# Horizontal lollipop
hlollipop(df, "x", "y")
}
}

View file

@ -75,6 +75,10 @@ point(
\item{caption}{Plot caption. Default to NULL.}
\item{theme_fun}{Whatever theme. Default to theme_point(). NULL if no theming needed.}
\item{scale_fill_fun}{Scale fill function. Default to scale_fill_visualizer_discrete().}
\item{scale_color_fun}{Scale color function. Default to scale_color_visualizer_discrete().}
}
\description{
Simple scatterplot

View file

@ -46,6 +46,8 @@ scale_color_visualizer_continuous(
\item{reverse_guide}{Boolean indicating whether the guide should be reversed.}
\item{title_position}{Position of the title. See [ggplot2::guide_legend()]'s title.position argument.}
\item{...}{Additional arguments passed to [ggplot2::discrete_scale()] if discrete or [ggplot2::scale_fill_gradient()] if continuous.}
}
\description{

View file

@ -1,10 +1,11 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/theme_bar.R, R/theme_default.R,
% R/theme_dumbbell.R, R/theme_point.R
% R/theme_dumbbell.R, R/theme_lollipop.R, R/theme_point.R
\name{theme_bar}
\alias{theme_bar}
\alias{theme_default}
\alias{theme_dumbbell}
\alias{theme_lollipop}
\alias{theme_point}
\title{Custom Theme for Bar Charts}
\usage{
@ -18,18 +19,18 @@ theme_bar(
theme_default(
title_font_family = "Carlito",
title_size = 16,
title_size = 20,
title_color = color("dark_grey"),
title_font_face = "bold",
title_hjust = NULL,
title_position_to_plot = TRUE,
subtitle_font_family = "Carlito",
subtitle_size = 15,
subtitle_size = 16,
subtitle_color = color("dark_grey"),
subtitle_font_face = "plain",
subtitle_hjust = NULL,
text_font_family = "Carlito",
text_size = 13,
text_size = 14,
text_color = color("dark_grey"),
text_font_face = "plain",
panel_background_color = "#FFFFFF",
@ -39,15 +40,15 @@ theme_default(
legend_direction = "horizontal",
legend_justification = "center",
legend_reverse = TRUE,
legend_title_size = 13,
legend_title_size = 14,
legend_title_color = color("dark_grey"),
legend_title_font_face = "plain",
legend_title_font_family = "Carlito",
legend_text_size = 13,
legend_text_size = 14,
legend_text_color = color("dark_grey"),
legend_text_font_face = "plain",
legend_text_font_family = "Carlito",
facet_size = 14,
facet_size = 15,
facet_color = color("dark_grey"),
facet_font_face = "bold",
facet_font_family = "Carlito",
@ -61,7 +62,7 @@ theme_default(
axis_line_y = TRUE,
axis_ticks_y = TRUE,
axis_text_font_family = "Carlito",
axis_text_size = 13,
axis_text_size = 14,
axis_text_color = color("dark_grey"),
axis_text_font_face = "plain",
axis_title_size = 15,
@ -83,17 +84,26 @@ theme_default(
caption_font_family = "Carlito",
caption_font_face = "plain",
caption_position_to_plot = TRUE,
caption_size = 11,
caption_size = 12,
caption_color = color("dark_grey"),
...
)
theme_dumbbell()
theme_lollipop(
flip = TRUE,
axis_text_x_angle = 0,
axis_text_x_vjust = 0.5,
axis_text_x_hjust = 0.5
)
theme_point()
}
\arguments{
\item{flip}{Logical. Whether the plot is flipped (horizonal).}
\item{flip}{Logical. Whether the plot is flipped (horizontal).}
\item{add_text}{TRUE or FALSE. Add values as text.}
\item{axis_text_x_angle}{Angle for x-axis text.}
@ -101,18 +111,30 @@ theme_point()
\item{axis_text_x_hjust}{Horizontal justification for x-axis text.}
\item{title_font_family}{Title font family. Default to "Roboto Condensed".}
\item{title_font_family}{Title font family. Default to "Carlito".}
\item{title_size}{The size of the legend title. Defaults to 11.}
\item{title_size}{The size of the title. Defaults to 12.}
\item{title_color}{Legend title color.}
\item{title_color}{Title color.}
\item{title_font_face}{Legend title font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic").}
\item{title_font_face}{Title font face. Default to "bold". Font face ("plain", "italic", "bold", "bold.italic").}
\item{title_hjust}{Title horizontal justification. Default to NULL. Use 0.5 to center the title.}
\item{title_position_to_plot}{TRUE or FALSE. Positioning to plot or to panel?}
\item{subtitle_font_family}{Subtitle font family. Default to "Carlito".}
\item{subtitle_size}{The size of the subtitle. Defaults to 10.}
\item{subtitle_color}{Subtitle color.}
\item{subtitle_font_face}{Subtitle font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic").}
\item{subtitle_hjust}{Subtitle horizontal justification. Default to NULL. Use 0.5 to center the subtitle.}
\item{text_font_family}{Text font family. Default to "Carlito".}
\item{text_size}{The size of all text other than the title, subtitle and caption. Defaults to 10.}
\item{text_color}{Text color.}
@ -139,12 +161,26 @@ theme_point()
\item{legend_title_font_face}{Legend title font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic").}
\item{legend_title_font_family}{Legend title font family. Default to "Carlito".}
\item{legend_text_size}{Legend text size.}
\item{legend_text_color}{Legend text color.}
\item{legend_text_font_face}{Legend text font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic").}
\item{legend_text_font_family}{Legend text font family. Default to "Carlito".}
\item{facet_size}{Facet font size.}
\item{facet_color}{Facet font color.}
\item{facet_font_face}{Facet font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic").}
\item{facet_font_family}{Facet font family. Default to "Carlito".}
\item{facet_bg_color}{Facet background color.}
\item{axis_x}{Boolean. Do you need x-axis?}
\item{axis_y}{Boolean. Do you need y-axis?}
@ -161,6 +197,8 @@ theme_point()
\item{axis_ticks_y}{Boolean. Do you need the line for the y-axis?}
\item{axis_text_font_family}{Axis text font family. Default to "Carlito".}
\item{axis_text_size}{Axis text size.}
\item{axis_text_color}{Axis text color.}
@ -193,19 +231,39 @@ theme_point()
\item{grid_minor_y_size}{Minor Y line size.}
\item{caption_font_family}{Caption font family. Default to "Carlito".}
\item{caption_font_face}{Caption font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic").}
\item{caption_position_to_plot}{TRUE or FALSE. Positioning to plot or to panel?}
\item{...}{Additional arguments passed to [ggplot2::theme()].}
\item{caption_size}{The size of the caption. Defaults to 10.}
\item{font_family}{The font family for all plot's texts. Default to "Segoe UI".}
\item{caption_color}{Caption color.}
\item{...}{Additional arguments passed to [ggplot2::theme()].}
}
\value{
A custom theme object.
A ggplot2 theme object
A custom theme object.
}
\description{
Give some reach colors and fonts to a ggplot.
Theme for dumbbell charts based on theme_default.
A custom theme specifically designed for lollipop charts with appropriate grid lines and axis styling
based on whether the chart is flipped (horizontal) or not.
}
\examples{
\dontrun{
library(ggplot2)
df <- data.frame(x = letters[1:5], y = c(10, 5, 7, 12, 8))
ggplot(df, aes(x, y)) +
geom_point() +
theme_lollipop()
}
}