| plot_point | R Documentation |
Create a scatterplot for two variables.
plot_point(
data,
x,
y,
facet_var = NULL,
facet_scale = "free",
facet_nrow = NULL,
facet_ncol = NULL,
color = NULL,
title = NULL,
subtitle = NULL,
xlab = NULL,
ylab = NULL,
caption = NULL,
point_size = 1.5,
point_type = 16,
point_color = "grey35",
point_alpha = 1,
theme_set = theme_tscv(),
theme_config = list(),
...
)
data |
A |
x |
Unquoted column in |
y |
Unquoted column in |
facet_var |
Optional unquoted column in |
facet_scale |
Character value defining facet axis scaling. Common values
are |
facet_nrow |
Optional integer. Number of rows in the facet layout. |
facet_ncol |
Optional integer. Number of columns in the facet layout. |
color |
Optional unquoted column in |
title |
Character value. Plot title. |
subtitle |
Character value. Plot subtitle. |
xlab |
Character value. Label for the x-axis. |
ylab |
Character value. Label for the y-axis. |
caption |
Character value. Plot caption. |
point_size |
Numeric value defining the point size. |
point_type |
Numeric or character value defining the point shape. |
point_color |
Character value defining the point color. Ignored when
|
point_alpha |
Numeric value between |
theme_set |
A complete |
theme_config |
A named |
... |
Currently not used. |
plot_point() is a convenience wrapper around
ggplot2::geom_point(). It is useful for plotting relationships between
two variables, for example observed values over time, forecast errors by
horizon, or one numeric diagnostic against another.
The arguments x, y, facet_var, and color are
passed as unquoted column names.
If color is supplied, point colors are mapped to that variable and
point_color is ignored. If color is not supplied, all points are
drawn using point_color.
Additional theme settings can be supplied through theme_config. This
should be a named list of arguments passed to ggplot2::theme().
An object of class ggplot.
Other data visualization:
plot_bar(),
plot_density(),
plot_histogram(),
plot_line(),
plot_qq(),
scale_color_tscv(),
scale_fill_tscv(),
theme_tscv(),
tscv_cols(),
tscv_pal()
library(dplyr)
data <- M4_monthly_data |>
filter(series == "M23100")
plot_point(
data = data,
x = index,
y = value,
title = "M4 Monthly Time Series",
subtitle = "Series M23100",
xlab = "Time",
ylab = "Value"
)
acf_data <- estimate_acf(
.data = M4_monthly_data |>
filter(series %in% c("M23100", "M14395")),
context = list(
series_id = "series",
value_id = "value",
index_id = "index"
),
lag_max = 12
)
plot_point(
data = acf_data,
x = lag,
y = value,
color = series,
title = "Autocorrelation by Series",
subtitle = "Sample autocorrelation up to lag 12",
xlab = "Lag",
ylab = "ACF",
point_size = 4
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.