lollipop_chart: Lollipop Chart

Description Usage Arguments Value Author(s) Examples

View source: R/lollipop_chart.R

Description

Use this function to create a lollipop chart to compare a numeric variables with a factor variable

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
lollipop_chart(
  plot_data,
  x_name,
  y_name,
  line_color = "#bdbdbd",
  x_color = "#5884d6",
  plot_height = NULL,
  plot_width = NULL,
  show_legend = FALSE,
  show_x_axis_grid = FALSE,
  show_y_axis_grid = FALSE,
  marker_size = marker_default_size,
  plot_title = NULL,
  x_axis_title = NULL,
  y_axis_title = NULL
)

Arguments

plot_data

This is the data.frame which will be used for the plot

x_name

The column name of one of the the variable in the x-axis, It has to be a numeric variable

y_name

The column name of the the variable in the y-axis, It has to be a factor variable

line_color

string. This is the color of the line between the two points, defaults to a grey shade

x_color

string. This is the color of the point made by x_name variable, defaults to a bluish color

plot_height

num. The height of the plot, If not provided the plot will take the whole area available in the UI

plot_width

num. The height of the plot, If not provided the plot will take the whole area available in the UI

show_legend

boolean. This will let you display or hide the grids in the x-axis, default hidden

show_x_axis_grid

boolean. This will let you display or hide the grids in the x-axis, default hidden

show_y_axis_grid

boolean. This will let you display or hide the grids in the y-axis, default hidden

marker_size

num. This is the size of the markers in the scatter plot, defaults to marker_default_size from constants.R

plot_title

string. This is the title of the plot, defauts to NULL

x_axis_title

string. This is the x-axis title of the plot, defaults to NULL

y_axis_title

string. This is the y-axis title of the plot, defaults to NULL

Value

Returns a plotly plot object which can be rendered as HTML

Author(s)

Vedha Viyash

Examples

1
2
3
4
5
6
7
8
## This will load two data.frames `marks_data` and `gender_school_earnings`
data("tidychartsdata")

## You can plot a lollipop chart using by just specifying data, x_name and y_name.
lollipop_chart(gender_school_earnings, Men, School)

## If you want to specify particular color, you can specify them to their respective arguments
lollipop_chart(gender_school_earnings, Men, School, line_color = "#afdeb5", x_color = "#4dbd5b")

vedhav/tidycharts documentation built on Nov. 15, 2020, 3:26 p.m.