Description Usage Arguments Value See Also Examples
Display large data set in ggplot
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
data |
Dataset to use for generating the plot. If not provided, data must be supplied in each layer of the plot. For best performance, particularly when processing large datasets, use of data.table is recommended. |
mapping |
Default list of aesthetic mappings to use for plot. The same with |
... |
Other arguments which will be passed through to layers. |
plot_width |
Integer. The width of the image to plot; must be a positive integer. A higher value indicates a higher resolution. |
plot_height |
Integer. The height of the image to plot; must be a positive integer. A higher value indicates a higher resolution. |
x_range |
Vector of type numeric. The range of |
y_range |
Vector of type numeric. The range of |
background |
Character. The background color of the image to plot. |
color |
Vector of type character. It will determine this color vector is a
|
show_raster |
Logical. Should the raster be displayed? |
drop_data |
Logical. When working with large datasets, drops the original data once processed according to the provided
|
variable_check |
Logical. If |
alpha |
The transparency of points, from 0 to 1. |
shape |
The shape of points, see pch. |
point_size |
The size of points. |
a 'ggplot' object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ## Not run:
if(requireNamespace("ggplot2") && requireNamespace("data.table") &&
requireNamespace("lubridate")) {
# Load data
url1 <- "https://raw.githubusercontent.com/plotly/datasets/master/uber-rides-data1.csv"
ridesRaw_1 <- url1 %>%
data.table::fread(stringsAsFactors = FALSE)
url2 <- "https://raw.githubusercontent.com/plotly/datasets/master/uber-rides-data2.csv"
ridesRaw_2 <- url2 %>%
data.table::fread(stringsAsFactors = FALSE)
url3 <- "https://raw.githubusercontent.com/plotly/datasets/master/uber-rides-data3.csv"
ridesRaw_3 <- url3 %>%
data.table::fread(stringsAsFactors = FALSE)
ridesDf <- list(ridesRaw_1, ridesRaw_2, ridesRaw_3) %>%
data.table::rbindlist()
time <- lubridate::ymd_hms(ridesDf$`Date/Time`)
ridesDf <- ridesDf[, 'Date/Time':=NULL][, list(Lat,
Lon,
hour = lubridate::hour(time),
month = lubridate::month(time),
day = lubridate::day(time))]
# continuous variable legend
ggRasterly(data = ridesDf,
mapping = aes(x = Lat, y = Lon),
color = fire_map
)
# discreate variable legend
ggRasterly(data = ridesDf,
mapping = aes(x = Lat, y = Lon, color = hour),
color = hourColors_map
) +
ggplot2::labs(title = "New York Uber",
subtitle = "Apr to Sept, 2014",
caption =
"https://raw.githubusercontent.com/plotly/datasets/master")
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.