Description Usage Arguments Value Author(s) References See Also Examples
Draw a line plot using ggplot2
1 2 3 4 |
data |
data.frame or a numeric vector. Columns are variables and rows are observations. |
xName |
The name of column containing x variable (i.e groups). |
yName |
The name of column containing y variable. |
groupName |
The name of column containing group variable. This variable is used to color plot according to the group. |
addPoint |
If TRUE, points are added to the plot. Default value is FALSE. |
pointSize, pointShape, pointFill, pointColor |
Modify point size, shape, fill and color. |
arrow |
arrow is function from package grid. This function Describe arrows to add to a line. See ?grid::arrow for more details. Usage : arrow=arrow(). Default value is NULL. |
xAxisType |
Indicate the type of x-axis. Possible values =c("categorical", "continuous"). Default value is "categorical". When the variable on the x-axis is numeric, it is sometimes useful to treat it as continuous, and sometimes useful to treat it as categorical. |
groupColors |
Color of groups. groupColors should have the same length as groups. |
brewerPalette |
This can be also used to indicate group colors. In this case the parameter groupColors should be NULL. e.g: brewerPalette="Paired". |
... |
Other arguments passed on to ggplot2.customize custom function or to geom_line functions from ggplot2 package. |
a ggplot
Alboukadel Kassambara <alboukadel.kassambara@gmail.com>
http://www.sthda.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #data
df <- data.frame(time = factor(c("Lunch","Dinner"), levels=c("Lunch","Dinner")),
total_bill = c(14.89, 17.23))
#plot
ggplot2.lineplot(data=df, xName="time", yName='total_bill',
mainTitle="Plot of total bill\n per time of day",
xtitle="Time of day", ytitle="Total bill")
#Or use this
plot<-ggplot2.lineplot(data=df, xName="time", yName='total_bill')
plot<-ggplot2.customize(plot, mainTitle="Plot of total bill\n per time of day",
xtitle="Time of day", ytitle="Total bill")
print(plot)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.