plot_green_index: Plot the green index

View source: R/plot_green_index.R

plot_green_indexR Documentation

Plot the green index

Description

This function plots the green index for the highway network with extensive customization options. Users can set various parameters like text size, color palette, resolution, base map, line width, line type, and more.

Usage

plot_green_index(
  green_index_data,
  base_map = "CartoDB.DarkMatter",
  colors = c("#F0BB62", "#BFDB38", "#367E18"),
  text_size = 12,
  resolution = 350,
  title = NULL,
  xlab = NULL,
  ylab = NULL,
  legend_title = "Green_Index",
  legend_position = "right",
  theme = ggplot2::theme_minimal(),
  line_width = 0.8,
  line_type = "solid",
  interactive = FALSE,
  filename = NULL
)

Arguments

green_index_data

A data frame containing the calculated green index values for each edge.

base_map

Character, base map to use. Default is "CartoDB.DarkMatter". Other options include "Stamen.Toner", "CartoDB.Positron", "Esri.NatGeoWorldMap", "MtbMap", "Stamen.TonerLines", and "Stamen.TonerLabels".

colors

Character vector, colors for the gradient. Default is c("#F0BB62", "#BFDB38", "#367E18").

text_size

Numeric, size of the text in the plot. Default is 12.

resolution

Numeric, resolution of the plot. Default is 350.

title

Character, title for the plot. Default is NULL.

xlab

Character, x-axis label for the plot. Default is NULL.

ylab

Character, y-axis label for the plot. Default is NULL.

legend_title

Character, legend title for the plot. Default is "Green_Index".

legend_position

Character, legend position for the plot. Default is "right".

theme

ggplot theme object, theme for the plot. Default is ggplot2::theme_minimal().

line_width

Numeric, width of the line for the edges. Default is 0.8.

line_type

Character or numeric, type of the line for the edges. Default is "solid".

interactive

Logical, whether to return an interactive plot using leaflet. Default is FALSE.

filename

Character, filename to save the plot. Supported formats include HTML. Default is NULL (no file saved).

Value

If interactive = TRUE, returns a Leaflet map object. If interactive = FALSE, returns a ggplot object. If a filename is provided, saves the plot to the specified file.


greenR documentation built on June 29, 2024, 9:07 a.m.