r-plotly

Disable hover information for a specific layer (geom) of plotly

落花浮王杯 提交于 2019-12-08 01:18:16
问题 library(ggplot2) library(plotly) gg <- ggplot(mtcars, aes(factor(vs), drat)) + geom_violin() + geom_jitter() ggplotly(gg) In example code we use ggplot to plot violin and jitter layers. Plotly displays information for both layers (i.e. when hovered over jitter point it will display specific point information, same thing happens when hovered over the violin plot). However, I want plotly to display information only for geom_jitter . Question: How to disable hovered information for specific

Disable hover information for a specific layer (geom) of plotly

断了今生、忘了曾经 提交于 2019-12-06 12:09:31
library(ggplot2) library(plotly) gg <- ggplot(mtcars, aes(factor(vs), drat)) + geom_violin() + geom_jitter() ggplotly(gg) In example code we use ggplot to plot violin and jitter layers. Plotly displays information for both layers (i.e. when hovered over jitter point it will display specific point information, same thing happens when hovered over the violin plot). However, I want plotly to display information only for geom_jitter . Question: How to disable hovered information for specific layer? You can set the hoverinfo to "none" for that geom : gg <- ggplot(mtcars, aes(factor(vs), drat)) +

Plot ellipse3d in R plotly?

允我心安 提交于 2019-12-06 11:32:49
Package rgl includes a very useful function ellipse3d , which can return an ellipsoid that cover like 95% percent of the points in 3D. Then this object can be used in rgl::plot3d to plot it out. My question is that is it possible to convert the output of ellipse3d to something that can be plotted through js plotting packages like plotly? library(rgl) dt <- cbind(x = rnorm(100), y = rnorm(100), z = rnorm(100)) ellipse <- ellipse3d(cov(dt)) plot3d(dt) plot3d(ellipse, add = T, color = "red", alpha = 0.5) Then what can I do to plot the ellipsoid through plotly? You can extract the coordinates of

Add plotly traces dynamically on shiny

孤街醉人 提交于 2019-12-06 07:49:28
问题 I am building an app that allows a user to dynamically add and remove traces on a plotly graph using selectInput. I have tried to play around with plotlyProxy () and plotlyProxyInvoke () from plotly package to no avail. Below is my rudimental code : library(shiny) library(shinydashboard) library(plotly) ui <- dashboardPage( dashboardHeader(), dashboardSidebar( sidebarMenu( menuItem("Search", tabName = "Tabs", icon = icon("object-ungroup")) ) ), dashboardBody( tabItem(tabName = "Tabs",

How to draw ellipsoid with plotly

跟風遠走 提交于 2019-12-06 04:20:13
Are there any way to plot a surface like ellipsoid with plotly 3D? Currently only surfaces of the form z=f(x,y) are discussed in the docs. There is also Mesh 3D , but I found no examples for it. It seem to be possible to make a triangulation of ellipsoid manually and then use Mesh to get ellipsoid, but it looks a bit difficult for me. Are there any better way to do it? Okay, it is easier than I thought. There is alphahull option that asks plotly to calculate the corresponding triangulation automatically. from plotly.offline import iplot, init_notebook_mode from plotly.graph_objs import Mesh3d

Plotting Ellipse3d in R Plotly with surface ellipse

為{幸葍}努か 提交于 2019-12-06 04:05:25
Similar to the question here but this didn't give me excatly what I needed and I couldn't figure it out: Plot ellipse3d in R plotly? . I want to recreate rgl's ellipse3d and surface ellipsoid in plotly. I know there there was an anwer which allowed plotting of an ellipse but as individual opaque markers, I need to get it as a surface ellipsoid that's slightly opaque so I can still see the data points in the ellipsoid. I tried to figure out how dww's comment for "add_surface" instead works but couldn't figure it out.... Can anyone help please? if (!require("rgl")) install.packages("rgl") dt <-

How to set plotly chart to have a transparent background in R?

好久不见. 提交于 2019-12-05 03:04:48
Here's what I have, so far: f1 <- list( family = "Arial, sans-serif", size = 25, color = "white" ) f2 <- list( family = "Old Standard TT, serif", size = 14, color = "black" ) a <- list( title = "SALES PER SONG", titlefont = f1, showgrid = FALSE, showticklabels = TRUE, showline=TRUE, tickangle = 45, tickfont = f2 ) salesplot <-plot_ly(producersales, type="scatter", x=Producer, y=SalesPerSong, color=SongRange, colors=cols, mode="markers", size=SalesPerSong) %>% layout(xaxis = a, yaxis = a) I tried adding paper_bgcolor=#00000000, plot_bgcolor=#00000000 after the x and y axis information within

How to customize hover text for plotly boxplots in R

折月煮酒 提交于 2019-12-04 23:30:04
问题 I understand how to customize the hover text for scatter plots in plotly , but box plots do not accept the 'text' attribute. Warning message: 'box' objects don't have these attributes: 'text' . I have over 300 x-axis variables and there are numbered samples(1-50) in two groups(A or B) that I want to plot together in the same box plot, then I'd like to differentiate between the sample numbers and groups through hover text when moving the cursor over outliers. I'd like to have my custom data

How to format data for plotly sunburst diagram

浪子不回头ぞ 提交于 2019-12-04 20:23:44
I'm trying to make an sunburst diagram using Plotly via R. I'm struggling with the data model required for the hierarchy, both in terms of conceptualizing how it works, and seeing if there are any easy ways to transform a regular dataframe, with columns representing different hierarchical levels, into the format needed. I've looked at examples for plotly sunburst charts in R, e.g., here , and seen the reference page but don't totally get the model for data formatting. # Create some fake data - say ownership and land use data with acreage df <- data.frame(ownership=c(rep("private", 3), rep(

Add plotly traces dynamically on shiny

北城以北 提交于 2019-12-04 14:57:47
I am building an app that allows a user to dynamically add and remove traces on a plotly graph using selectInput. I have tried to play around with plotlyProxy () and plotlyProxyInvoke () from plotly package to no avail. Below is my rudimental code : library(shiny) library(shinydashboard) library(plotly) ui <- dashboardPage( dashboardHeader(), dashboardSidebar( sidebarMenu( menuItem("Search", tabName = "Tabs", icon = icon("object-ungroup")) ) ), dashboardBody( tabItem(tabName = "Tabs", fluidRow( column(width=3, box( title="SELECT ", solidHeader=TRUE, collapsible=TRUE, width=NULL, selectInput(