Description Usage Arguments Value Author(s) Examples
View source: R/lollipop_chart.R
Use this function to create a lollipop chart to compare a numeric variables with a factor variable
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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 |
Returns a plotly plot object which can be rendered as HTML
Vedha Viyash
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.