This function calculates the mean y-value for each x-value. Should be used
only when x
is discrete. The resulting mean can be mapped to any
aesthetic, specified with the output
parameter.
stat_meanByHour( mapping = NULL, data = NULL, input = NULL, output = "y", geom = "bar", position = "identity", na.rm = TRUE, show.legend = NA, inherit.aes = TRUE, ... )
mapping | Set of aesthetic mappings created by |
---|---|
data | The data to be displayed in this layer. There are three options:
if |
input | The value to find the mean of. If |
output | "AQIColors", "mv4Colors", "scaqmd", "y" |
geom | The geometic object to display the data |
position | Position adjustment, either as a string, or the result of a call to a position adjustment function. |
na.rm | remove NA values from data |
show.legend | logical indicating whether this layer should be included in legends. |
inherit.aes | if |
... | additional arguments passed on to |
if (FALSE) { library(AirMonitorPlots) ggplot_pm25Timeseries( AirMonitor::NW_Megafires, startdate = 20150820, enddate = 20150831 ) + geom_point(shape = "square", alpha = 0.05) + stat_meanByHour(geom = "line", color = "orange", size = 3) ggplot_pm25Diurnal( AirMonitor::Carmel_Valley, startdate = 20160801, enddate = 20160810 ) + geom_path(aes(group = day), color = "gray50") + stat_meanByHour(geom = "line", size = 4) }