ggplot2
library(tidyverse)
ggplot(economics, aes(date, psavert, color = "savings rate")) +
geom_line(key_glyph = "timeseries")
# key_glyph图例
# geom_line(key_glyph = draw_key_rect)
df <- data.frame(x = 1:10, y = (1:10)^2)
ggplot(df, aes(x, y)) +
geom_point() +
stat_function(fun = ~ .x^2)
library(sf)
nc <- st_read(system.file("gpkg/nc.gpkg", package = "sf"), quiet = TRUE)
ggplot(nc) +
geom_sf(data = nc, aes(fill = AREA)) +
theme_void()
ggplot(economics, aes(date, psavert, color = "savings rate")) +
geom_line(key_glyph = "timeseries")
# key_glyph图例
# geom_line(key_glyph = draw_key_rect)
df <- data.frame(x = 1:10, y = (1:10)^2)
ggplot(df, aes(x, y)) +
geom_point() +
stat_function(fun = ~ .x^2)
library(sf)
nc <- st_read(system.file("gpkg/nc.gpkg", package = "sf"), quiet = TRUE)
ggplot(nc) +
geom_sf(data = nc, aes(fill = AREA)) +
theme_void()
评论
发表评论