Assuming breaks
is a vector with the values you want to plot, here's how to transform the base R code to ggplot2:
main.r289 chars8 lines
The data.frame
function is used to create a data frame with the x
variable, which is created using 1:length(breaks)
, and the y
variable, which is breaks
. The ggplot function takes the df
data frame and sets x
and y
aesthetics via aes
. Then, you add a line layer with geom_line
and set the color to blue and line width to 1. Finally, labs
is used to set the x-axis label.
gistlibby LogSnag