made it easier to save in multiple formats
This commit is contained in:
parent
82fc901902
commit
f6f22d5d97
@ -9,23 +9,8 @@ ifelse(!dir.exists(file.path(getwd(), figure_dir)), dir.create(file.path(getwd()
|
||||
colors <- list(darkblue = "#062e57",
|
||||
lightblue = "#b1dcf3")
|
||||
|
||||
|
||||
# save figure
|
||||
tiff(filename = paste0(figure_dir,"/map.tiff"),
|
||||
width = 11,
|
||||
height = 17,
|
||||
units = "in",
|
||||
res = 600,
|
||||
compression = "lzw")
|
||||
|
||||
png(filename = paste0(figure_dir, "/map.png"),
|
||||
width = 11,
|
||||
height = 17,
|
||||
units = "in",
|
||||
res = 600)
|
||||
|
||||
# plot map
|
||||
|
||||
plot_map <- function () {
|
||||
plot(sf::st_geometry(extent_poly),
|
||||
col = colors$darkblue,
|
||||
extent = extent_bbox,
|
||||
@ -54,6 +39,22 @@ plot(sf::st_geometry(data$NHDFlowline),
|
||||
xlim = c(extent$longitude_min, extent$longitude_max),
|
||||
ylim = c(extent$latitude_min, extent$latitude_max),
|
||||
add = TRUE)
|
||||
# finish saving figure
|
||||
}
|
||||
|
||||
# save figure
|
||||
tiff(filename = paste0(figure_dir,"/map.tiff"),
|
||||
width = 11,
|
||||
height = 17,
|
||||
units = "in",
|
||||
res = 600,
|
||||
compression = "lzw")
|
||||
plot_map()
|
||||
dev.off()
|
||||
|
||||
png(filename = paste0(figure_dir, "/map.png"),
|
||||
width = 11,
|
||||
height = 17,
|
||||
units = "in",
|
||||
res = 600)
|
||||
plot_map()
|
||||
dev.off()
|
Loading…
x
Reference in New Issue
Block a user