dotted_line: Dotted line Adds dotted line with label to plot_ly plot

View source: R/dotted_line.R

dotted_lineR Documentation

Dotted line Adds dotted line with label to plot_ly plot

Description

Dotted line Adds dotted line with label to plot_ly plot

Usage

dotted_line(
  plot,
  df,
  x_col,
  line_val,
  gluetext,
  .yshift = 5,
  .xshift = 2,
  .showarrow = T,
  .lineadjust = 0.5
)

Arguments

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

Value

plot_ly plot with dotted line and label on dotted line

Examples

{

quickplot <- plotly::plot_ly(mtcars,
x = ~ carb,
y = ~ disp,
type = "bar")

dotted_line(quickplot, mtcars, "carb", 200, "200 line")

}

dpowerstp/plotlywrappers documentation built on May 3, 2022, 10:29 p.m.