Skip to content

Commit

Permalink
fix #153 ndcd_plot sorted I think
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed May 4, 2016
1 parent 6cf9ba4 commit c8381a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 6 additions & 6 deletions R/ncdc_plot.r
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#' Plot NOAA climate data.
#'
#' This function accepts directly output from the \code{\link[rnoaa]{ncdc}} function,
#' not other functions.
#'
#' @export
#'
#' @param ... Input noaa object or objects.
#' @param breaks Regularly spaced date breaks for x-axis. See examples for usage.
#' See \code{\link{date_breaks}}. Default: \code{NULL} (uses ggplot2 default break
Expand All @@ -13,6 +9,9 @@
#' x-axis. See \code{\link{date_format}}
#' @return ggplot2 plot
#' @details
#' This function accepts directly output from the \code{\link[rnoaa]{ncdc}} function,
#' not other functions.
#'
#' This is a simple wrapper function around some ggplot2 code. There is indeed a lot you
#' can modify in your plots, so this function just does some basic stuff. Look at the internals
#' for what the function does.
Expand All @@ -27,7 +26,7 @@
#' ncdc_plot(out, breaks="1 month", dateformat="%d/%m")
#'
#' out2 <- ncdc(datasetid='GHCND', stationid='GHCND:USW00014895', datatypeid='PRCP',
#' startdate = '2010-05-01', enddate = '2010-05-03', limit=100)
#' startdate = '2010-05-01', enddate = '2010-05-15', limit=500)
#' ncdc_plot(out2, breaks="6 hours", dateformat="%H")
#'
#' # Combine many calls to ncdc function
Expand Down Expand Up @@ -81,7 +80,8 @@ plot_template <- function(df, breaks, dateformat) {
labs(y = as.character(df[1, 'datatype']), x = "Date")
)
if (!is.null(breaks)) {
c(tt, scale_x_datetime(breaks = date_breaks(breaks), labels = date_format(dateformat)))
c(tt, scale_x_date(date_breaks = breaks, date_labels = dateformat))
#c(tt, scale_x_datetime(breaks = date_breaks(breaks), labels = date_format(dateformat)))
} else {
tt
}
Expand Down
8 changes: 5 additions & 3 deletions man/ncdc_plot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c8381a7

Please sign in to comment.