View source: R/plot_sensorimage_legend.R
plot_sensorimage_legend | R Documentation |
This function adds a legend to a sensor image
plot_sensorimage_legend(
dta,
col_palette,
inset = c(0.5, -0.12),
cex = 1,
ncol = 5,
bg = NA,
...
)
dta |
data to be plotted (for instance temperature or pressure) |
col_palette |
color palette to use in the graphic |
inset |
where to place the legend default is at the bottom -0.12 |
cex |
size of labels |
ncol |
number of columns in legend, default is 5 |
bg |
whether or not to have a background, default is NA |
... |
Any additional parameters used by graphics::legend |
an image of the sensor data, for instance with activity it would produce an actogram
#specify the data location
data(hoopoe)
start = as.POSIXct("2016-07-01","%Y-%m-%d", tz="UTC")
end = as.POSIXct("2017-06-01","%Y-%m-%d", tz="UTC")
PAM_data = create_crop(hoopoe,start,end)
# make margins big so that there is enough space for margin
par( mfrow= c(1,1), oma=c(4,2,0,6))
col_palette = c("black",viridis::cividis(90))
par(mar = c(4,2,4,2))
plot_sensorimage(PAM_data$acceleration$date,
PAM_data$acceleration$act, main = "Activity",
col=col_palette, cex=1.2, cex.main = 2)
plot_sensorimage_legend(PAM_data$acceleration$act, col_palette)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.