plot_3_by_distance: create plot of 3 indicators versus distance This makes a very...

View source: R/plot_3_by_distance.R

plot_3_by_distanceR Documentation

create plot of 3 indicators versus distance This makes a very simple scatter plot of 3 variables on y axis as a function of distance on the x axis. For example, it can show risk, percent demographic score, and population density, e.g., using numbers created at random by sim_riskbydistance()

Description

create plot of 3 indicators versus distance This makes a very simple scatter plot of 3 variables on y axis as a function of distance on the x axis. For example, it can show risk, percent demographic score, and population density, e.g., using numbers created at random by sim_riskbydistance()

Usage

plot_3_by_distance(
  x,
  xname = "dist",
  xlab = "Distance (miles)",
  ynames = c("risk", "pctd", "popdensity"),
  mylegend = c("Risk", "% Demog", "Pop density"),
  mycolors = c("red", "orange", "blue")
)

Arguments

x

data.frame such as output from sim_riskbydistance(), with colnames like risk, pctd, popdensity, and dist (the defaults) or any 3 with values for y axis and 1 with values for x axis like distance.

xname

colname in x so that x,xname can be used as x values in plot

xlab

like in plot(), a string label for x axis

ynames

3 colnames in x, with 3 sets of y values for the scatter plot, but they have to be in the same units for the plot to make sense, so they could be percentages, or percentiles, for example.

mylegend

3 strings to use in legend(legend=mylegend, fill=mycolors)

mycolors

3 colors for legend

See Also

sim_riskbydistance()


ejanalysis/ejanalysis documentation built on April 2, 2024, 10:12 a.m.