dotted_line | R Documentation |
Dotted line Adds dotted line with label to plot_ly plot
dotted_line( plot, df, x_col, line_val, gluetext, .yshift = 5, .xshift = 2, .showarrow = T, .lineadjust = 0.5 )
plot |
plot_ly plot |
df |
Dataframe used to build plot_ly plot |
x_col |
String column name of x-axis |
line_val |
Value on y-axis at which to draw dotted line |
gluetext |
Text fed to glue::glue function used to label dotted line |
.yshift |
How far to shift label relative to y-axis; default 5 |
.xshift |
How far to shift label relative to x-axis; default 2 |
.showarrow |
Whether to show the arrow, T or F. Default true |
.lineadjust |
How much to adjust the position of the line along the x-axis. Default 0.5 |
plot_ly plot with dotted line and label on dotted line
{ quickplot <- plotly::plot_ly(mtcars, x = ~ carb, y = ~ disp, type = "bar") dotted_line(quickplot, mtcars, "carb", 200, "200 line") }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.