c_line
Plots a line at points specified by inputs x and y, and colored according to factor input z
Syntax
[p] = c_line(x, y, z, color_vector)% Matlab & Octave cline(x, y, z, color_vector) #R
Description
Plots a line at points specified by inputs x and y, and colored according to factor input z (with one color for each level of z).
Inputs
Input var | Description | Default value |
---|---|---|
x | x positions of points to be plotted | N/A |
y | y positions of points to be plotted | N/A |
z | a factor, the same length as x and y. Line segments in the resulting plot will be colored according to the levels of z. | N/A |
color_vector | a list of colors to use (length should match the number of levels in z). | N/A |
Outputs
Output var | Description | Units |
---|---|---|
p | plot of x and y with the color changes specified by color_vector between levels of z | N/A |
Notes & assumptions
- This function adds colored line segments to an existing plot.
- The line is plotted at points specified by inputs x and y, and colored according to factor input z (with one color for each level of z).
Example
Matlab & Octave
R
graphics::plot(NA, xlim = c(0, 30), ylim = c(0, 400)) cline(x=ChickWeight$Time, y=ChickWeight$weight, z=as.factor(ChickWeight$Diet), color_vector=c('black', 'grey20', 'grey50', 'grey70'))
About
bugs@animaltags.org Last modified: 24 July 2017