plot_sensorimage | R Documentation |
This function plots sensor data as an image. An actogram for instance is a type of sensor image.
plot_sensorimage( date, sensor_data, tz = "UTC", plotx = TRUE, ploty = TRUE, labelx = TRUE, labely = TRUE, offset = 0, dt = NA, xlab = "Hour", ylab = "Date", cex = 2, na.col = "white", col = c("black", viridis::magma(90)), ... )
date |
Date data in POSIXct format, most commonly |
sensor_data |
sensor data, for example look at |
tz |
Time zone for POSIXct, default set to "UTC" |
plotx |
wherether or not to plot the x axis ticks + labels (for instance when compiling multifigures) |
ploty |
wherether or not to plot the y axis ticks + labels (for instance when compiling multifigures) |
labelx |
wherether or not to write the name of the x axis (for instance when compiling multifigures) |
labely |
wherether or not to write the name of the y axis (for instance when compiling multifigures) |
offset |
This parameter determines where the center of the graph is. When |
dt |
the time interval to which the data are resampled (secs). Default is |
xlab |
label for x-axis (as a character string) |
ylab |
label for y axis (as a character string) |
cex |
size of labels |
na.col |
colour given to NA values, default is "white" |
col |
Colour scheme of plot. Default |
... |
Any additional parameters used by graphics::image |
an image of the sensor data, for instance with activity it would produce an actogram
## Not run: #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) # Create plots with 3 together (mfrow) par( mfrow= c(1,3), oma=c(0,2,0,6)) par(mar = c(4,2,4,2)) plot_sensorimage(PAM_data$acceleration$date, ploty=FALSE, PAM_data$acceleration$act, main = "Activity", col=c("black",viridis::cividis(90)), cex=1.2, cex.main = 2) par(mar = c(4,2,4,2)) plot_sensorimage(PAM_data$pressure$date, plotx=TRUE, ploty=FALSE, labely=FALSE, PAM_data$pressure$obs, main="Pressure", col=c("black",viridis::cividis(90)), cex=1.2, cex.main = 2) par(mar = c(4,2,4,2)) plot_sensorimage(PAM_data$temperature$date, labely=FALSE, PAM_data$temperature$obs, main="Temperature", col=c("black",viridis::cividis(90)), cex=1.2, cex.main = 2) ###################################################### # Look at a classification output ###################################################### # Classification classification = classify_flap(dta = PAM_data$acceleration, period = 10, to_plot=FALSE) par( mfrow= c(1,3), oma=c(0,2,0,6),mar = c(4,2,4,2)) plot_sensorimage(PAM_data$pressure$date, c(0,abs(diff(PAM_data$pressure$obs))), main="Pressure difference", ploty=FALSE, col=c("black",viridis::cividis(90)), cex=1.2, cex.main = 2) plot_sensorimage(PAM_data$acceleration$date, PAM_data$acceleration$act, main="Activity", ploty=FALSE, labely=FALSE, col=c(viridis::cividis(90)), cex=1.2, cex.main = 2) plot_sensorimage(PAM_data$acceleration$date, ifelse(classification$classification == classification$migration, 1,2), main="Migration Classification", labely=FALSE, na.col="white", col = c("orange","black"), cex=1.2, cex.main = 2) twilights <- GeoLight::twilightCalc(PAM_data$light$date, PAM_data$light$obs, LightThreshold = 2, ask = FALSE) plot_sensorimage_twilight(twilights$tFirst, offset=0, col= ifelse(twilights$type == 1, "goldenrod","cornflowerblue"), pch=16, cex=0.5) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.