multi_line | R Documentation |
Create multiple dotted lines in a plot_ly graph
multi_line( plot, df, x_col, yvec, textvec, .lineadjust = 0.5, .showarrow = T, .yshift = 5, .xshift = 2 )
plot |
Base-plotly chart |
df |
Base-dataframe |
x_col |
String name of x-axis column |
yvec |
Numeric vector of y-values at which to draw dotted lines |
textvec |
Character vector of labels for dotted lines; fed to glue function |
.lineadjust |
How much to adjust the length of the dotted line relative to the x-axis; default 0.5 |
.showarrow |
Whether to show an arrow pointing to the dotted line or not; default T |
.yshift |
How much to adjust the y-axis position of the text label relative to the dotted line; default 5 |
.xshift |
How much to adjust the x-axis position of the text label relative to the dotted line; default 2 |
{ quickplot <- plotly::plot_ly(mtcars, x = ~ carb, y = ~ disp, type = "bar") multi_line(quickplot, mtcars, "carb", c(200, 250), c("200 line", "250 line")) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.