added jpeg export

commented out tiff and jpeg
changed dimensions to 8X10
This commit is contained in:
Ben Varick 2023-10-18 11:31:09 -05:00
parent 214ff525cd
commit 17205a5c19

View File

@ -7,12 +7,12 @@ ifelse(!dir.exists(file.path(getwd(), figure_dir)), dir.create(file.path(getwd()
# set colors # set colors
colors <- list(darkblue = "#062e57", colors <- list(darkblue = "#062e57",
lightblue = "#b1dcf3", lightblue = "#b1dcf3",
lightgrey = "#6D6D6D") lightgrey = "#6D6D6D")
# set dimensions of figures # set dimensions of figures
width <- 8.5 width <- 8
height <- 11 height <- 10
units <- "in" units <- "in"
res <- 600 res <- 600
margin <- 0 margin <- 0
@ -20,45 +20,56 @@ margin <- 0
# plot map # plot map
plot_map <- function () { plot_map <- function () {
plot(sf::st_geometry(extent_poly), plot(sf::st_geometry(extent_poly),
col = colors$lightgrey, col = colors$lightgrey,
border = "black") border = "black")
plot(political$Wisconsin_State_Boundary_24K.geojson, plot(political$Wisconsin_State_Boundary_24K.geojson,
col = colors$darkblue, col = colors$darkblue,
border = NA, border = NA,
add = TRUE) add = TRUE)
plot(sf::st_geometry(data$NHDWaterbody), plot(sf::st_geometry(data$NHDWaterbody),
col = colors$lightblue, col = colors$lightblue,
border = NA, border = NA,
add = TRUE) add = TRUE)
plot(sf::st_geometry(data$NHDArea), plot(sf::st_geometry(data$NHDArea),
col = colors$lightblue, col = colors$lightblue,
border = NA, border = NA,
add = TRUE) add = TRUE)
plot(sf::st_geometry(data$NHDFlowline), plot(sf::st_geometry(data$NHDFlowline),
col = colors$lightblue, col = colors$lightblue,
lwd = data$NHDFlowline$TotDASqKM^0.3204*0.0446, lwd = data$NHDFlowline$TotDASqKM^0.3204*0.0446,
border = NA, border = NA,
add = TRUE) add = TRUE)
} }
# save figure # save figure
tiff(filename = paste0(figure_dir,"/map.tiff"), # tiff(filename = paste0(figure_dir,"/map.tiff"),
width = width, # width = width,
height = height, # height = height,
units = units, # units = units,
res = res, # res = res,
compression = "lzw") # compression = "lzw")
par(mai=c(margin, margin, margin, margin)) # par(mai=c(margin, margin, margin, margin))
par(mar=c(1,1,1,1)) # par(mar=c(1,1,1,1))
plot_map() # plot_map()
dev.off() # dev.off()
#
# jpeg(filename = paste0(figure_dir,"/map.jpg"),
# width = width,
# height = height,
# units = units,
# res = res,
# quality = 93)
# par(mai=c(margin, margin, margin, margin))
# par(mar=c(1,1,1,1))
# plot_map()
# dev.off()
png(filename = paste0(figure_dir, "/map.png"), png(filename = paste0(figure_dir, "/map.png"),
width = width, width = width,
height = height, height = height,
units = units, units = units,
res = res) res = res)
par(mai=c(margin, margin, margin, margin)) par(mai=c(margin, margin, margin, margin))
par(mar=c(1,1,1,1)) par(mar=c(1,1,1,1))
plot_map() plot_map()