Is it possible to set a theme with plotly in R? - r

plot_ly(x,y,z, type="scatter3d") + theme_igray()
Returns NULL. Is it possible at all to have theme with plotly?

The theme_igray() call looks like something from ggplot2. I don't think the plotly package supports ggplot2 themes, but ggplotly can convert a ggplot2 graph to plotly format, so you could theme it in ggplot2 then convert.
Unfortunately, there's no ggplot2 graph that corresponds to type="scatter3d". The gg3D package will produce a 2D graph in plotly.

Related

Using crosstalk with plotly sunburst graph

Wondering if anyone has tried using crosstalk with sunburst plots. My goal is to have two subursts with same labelling that both respond to a click.

Figuring out cause of Graphical differences between ggplot and base R plotting

I have plotted my data in both base R and ggplot methods to see how the plots look different, and my graph from ggplot() form looks wrong. It should look like it does when I graph it in base R. Shown below is my base R code and my ggplot code, and the graphs that each produce.
Base R code:
em is though.
Use geom_path() instead of geom_line() to preserve the ordering of the dataset. This is documented in ?geom_line

Multiple R plots with tooltips in one figure?

I want to create a new figure with interactive R-plots (with tooltips).
To show how I wish to have my plots I give an example using the mtcars data. I am using the package scatterD3 to get tooltips:
library(scatterD3)
data(mtcars)
tooltips <- paste('This is an incredible <strong>',rownames(mtcars),'</strong><br />with',mtcars$cyl,'cylinders !')
scatterD3(x=mtcars$wt,y=mtcars$mpg,tooltip_text=tooltips)
Now I don't want only one plot of this type in one figure. Usually it is possible to use par(mfrow=(i,j)) to create a figure with more than one plot. But it seems not to work for my interactive plots. Is there a way to do this?
Have you given a look to the plotly R package?
It has also a function to render the ggplots in ggplotly
An idea could be to create a multiplot with ggplot2 and than render it with ggplotly.
I've not yet tried it, so I don't know if it's really possible.

Stacked dot plot using ggplot2

I am interested in making a stacked dotplot like the one in link below in ggplot2.
The following was made using dotPlot function in BHH2 package but does not have the coloring and faceting ease of ggplot2.
There is a geom_dotplot which create dotplots. Update your ggplot2 if you don't have it. It is a relatively recent addition.
See this for examples.

How do I draw a violin plot using ggplot2?

Can I use ggplot2 to produce a violin plot? Perhaps using some variation of geom_boxplot()?
Version 0.9.0 includes the geom_violin: http://docs.ggplot2.org/current/geom_violin.html
A quick googling returns this site, which uses geom_ribbon to draw violin plots for Figure 3.14.
Note to anyone catching up
As #Ben points out below, geom_violin() is now the preferred method for producing violin plots in ggplot2.

Resources