supported ggplotly theme elements

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

plot of chunk unnamed-chunk-2

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!")

plot of chunk unnamed-chunk-5

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")

plot of chunk unnamed-chunk-7

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))

plot of chunk unnamed-chunk-9

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")

plot of chunk unnamed-chunk-11

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'