In this RPub I will give examples of the theme options for non-data elements currently implemented in ggplotly.
I will show several modified versions of the iris data scatterplot below.
library(ggplot2)
ggiris <- qplot(Petal.Width, Sepal.Length, data = iris, color = Species)
ggiris
First install and load library(plotly).
install.packages("devtools")
library(devtools)
install_github("plotly", "ropensci")
library(plotly)
py <- plotly("new_username", "YOUR_KEY")
## Loading required package: RCurl
## Loading required package: bitops
## Loading required package: RJSONIO
## Loading required package: plyr
The plot below has a custom title
ggiris + ggtitle("My amazing plot!")
py$ggplotly()
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
The plot below has a custom x axis label
ggiris + xlab("petal width, the most interesting feature of iris flowers")
py$ggplotly()
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
The plot below has a custom angled tick marks
ggiris + theme(axis.text.x = element_text(angle = 45))
py$ggplotly()
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
The plot below has a hidden legend by default
ggiris + theme(legend.position = "none")
py$ggplotly()
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'