ggcapellini | R Documentation |
tf
objectsPlots a miniature glyph / sparkline for each entry of a tf
-object.
(Capellini are tiny spaghetti – angel hair pasta.) Aesthetics x
and y
specify the location of the glyphs, the tf
aesthetic defines their shapes.
To accommodate all my fellow idiots, geom_cappelini
, geom_cappellini
and
geom_capelini
also work.
stat_capellini(
mapping = NULL,
data = NULL,
geom = "capellini",
position = "identity",
na.rm = TRUE,
show.legend = NA,
inherit.aes = TRUE,
arg = NULL,
add_lines = FALSE,
add_boxes = TRUE,
width = NULL,
height = NULL,
...
)
geom_capellini(
mapping = NULL,
data = NULL,
stat = "capellini",
position = "identity",
...,
na.rm = TRUE,
show.legend = NA,
inherit.aes = TRUE,
arg = NULL,
add_lines = TRUE,
add_boxes = TRUE,
width = NULL,
height = NULL,
box.colour = "#0000001A",
box.linetype = 1,
box.fill = NA,
box.linewidth = 0.1,
box.alpha = 0.1,
line.colour = "black",
line.linetype = 2,
line.linewidth = 0.3,
line.alpha = 0.5
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
geom |
The geometric object to use to display the data for this layer.
When using a
|
position |
A position adjustment to use on the data for this layer. This
can be used in various ways, including to prevent overplotting and
improving the display. The
|
na.rm |
remove NAs? defaults to |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
arg |
where to evaluate |
add_lines |
should a reference line in the middle of the range of the functions' values be added to each glyph? defaults to TRUE |
add_boxes |
should a box be added to frame each glyph? defaults to TRUE |
width |
the width of the glyphs. Defaults to 2/3 of the |
height |
the height of the glyphs. Defaults to 2/3 of the |
... |
Other arguments passed on to
|
stat |
that's "capellini"! |
box.colour |
aesthetic property of the box |
box.linetype |
aesthetic property of the box |
box.fill |
aesthetic property of the box |
box.linewidth |
aesthetic property of the box |
box.alpha |
aesthetic property of the box |
line.colour |
aesthetic property of the reference line |
line.linetype |
aesthetic property of the reference line |
line.linewidth |
aesthetic property of of the reference line |
line.alpha |
aesthetic property of the reference line |
tf
aestheticMandatory. Used to designate a column of class tf
to be visualized as glyphs.
GGally::glyphs
Other tidyfun visualization:
gglasagna()
,
ggspaghetti
## Not run:
# takes a little too long for CRAN
library(ggplot2)
library(tidyverse)
weather <- fda::CanadianWeather
canada <- data.frame(
place = weather$place,
region = weather$region,
lat = weather$coordinates[, 1],
lon = -weather$coordinates[, 2],
region = weather$region
)
canada$temp <- tfd(t(weather$dailyAv[, , 1]), arg = 1:365)
canada$precipl10 <- tfd(t(weather$dailyAv[, , 3]), arg = 1:365) |> tf_smooth()
canada_map <-
data.frame(maps::map("world", "Canada", plot = FALSE)[c("x", "y")])
# map of canada with annual temperature averages in red, precipitation in blue:
ggplot(canada, aes(x = lon, y = lat)) +
geom_capellini(aes(tf = precipl10), width = 3, height = 5, colour = "blue") +
geom_capellini(aes(tf = temp), width = 3, height = 5, colour = "red") +
geom_path(data = canada_map, aes(x = x, y = y), alpha = 0.1) +
coord_quickmap()
ggplot(canada, aes(x = lon, y = lat, colour = region)) +
geom_capellini(aes(tf = precipl10),
width = 5, height = 3,
line.linetype = 1, box.fill = "white", box.alpha = 0.5, box.colour = NA
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.