-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.0.1 fixed minor issues found with --as-cran check
- Loading branch information
Showing
12 changed files
with
55 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,52 @@ | ||
#' Plot method for rforecastio objects: | ||
# silly CRAN | ||
|
||
temperature <- humidity <- precipIntensity <- temperatureMinTime <- | ||
temperatureMin <- temperatureMaxTime <- temperatureMax <- NULL | ||
|
||
#' Plot method for rforecastio xs: | ||
#' | ||
#' Uses ggplot2 & grid.arrange to produce graphs for rforecastio objects | ||
#' Uses ggplot2 & grid.arrange to produce graphs for rforecastio xs | ||
#' | ||
#' @param object an rforecastio object | ||
#' @param x an rforecastio x | ||
#' @param \dots ignored | ||
#' @param readings specify which readings to plot. will plot all available by default | ||
#' @return frame grob | ||
#' | ||
#' @importFrom ggplot2 autoplot ggplot aes_string geom_line labs | ||
#' @importFrom ggplot2 theme_bw ggplotGrob aes scale_color_manual | ||
#' @importFrom gridExtra grid.arrange | ||
#' @export | ||
#' @method plot rforecastio | ||
plot.rforecastio <- function(object, ..., | ||
plot.rforecastio <- function(x, ..., | ||
readings=c("hourly", "minutely", "daily")) { | ||
|
||
|
||
lapply(readings[readings %in% names(object)], function(x) { | ||
lapply(readings[readings %in% names(x)], function(rdng) { | ||
|
||
gg <- ggplot() | ||
|
||
if (x == "hourly") { | ||
gg <- gg + geom_line(data=object[[x]], aes(x=time, y=temperature, color="Temperature")) | ||
gg <- gg + geom_line(data=object[[x]], aes(x=time, y=humidity*10, color="Humidity")) | ||
if (rdng == "hourly") { | ||
gg <- gg + geom_line(data=x[[rdng]], aes(x=time, y=temperature, color="Temperature")) | ||
gg <- gg + geom_line(data=x[[rdng]], aes(x=time, y=humidity*10, color="Humidity")) | ||
gg <- gg + scale_color_manual(name="Readings", values=c("green", "red")) | ||
|
||
} | ||
|
||
if (x == "minutely") { | ||
gg <- gg + geom_line(data=object[[x]], aes(x=time, y=precipIntensity, color="Precipitation\nIntensity")) | ||
if (rdng == "minutely") { | ||
gg <- gg + geom_line(data=x[[rdng]], aes(x=time, y=precipIntensity, color="Precipitation\nIntensity")) | ||
gg <- gg + scale_color_manual(name="Readings", values=c("blue")) | ||
} | ||
|
||
if (x == "daily") { | ||
gg <- gg + geom_line(data=object[[x]], aes(x=temperatureMinTime, y=temperatureMin, color="Temp (min)"), linetype=2) | ||
gg <- gg + geom_line(data=object[[x]], aes(x=temperatureMaxTime, y=temperatureMax, color="Temp (max)")) | ||
gg <- gg + geom_line(data=object[[x]], aes(x=time, y=humidity*100, color="Humidity")) | ||
if (rdng == "daily") { | ||
gg <- gg + geom_line(data=x[[rdng]], aes(x=temperatureMinTime, y=temperatureMin, color="Temp (min)"), linetype=2) | ||
gg <- gg + geom_line(data=x[[rdng]], aes(x=temperatureMaxTime, y=temperatureMax, color="Temp (max)")) | ||
gg <- gg + geom_line(data=x[[rdng]], aes(x=time, y=humidity*100, color="Humidity")) | ||
gg <- gg + scale_color_manual(name="Readings", values=c("green", "red", "red")) | ||
} | ||
|
||
gg <- gg + labs(x=NULL, y=NULL, title=sprintf("%s readings", x)) | ||
gg <- gg + labs(x=NULL, y=NULL, title=sprintf("%s readings", rdng)) | ||
gg <- gg + theme_bw() | ||
|
||
gg | ||
|
||
}) -> plots | ||
}) -> the_plots | ||
|
||
do.call(grid.arrange, c(plots, ncol=1)) | ||
do.call(grid.arrange, c(the_plots, ncol=1)) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters