plotly

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

Python Plotly - Multiple dropdown plots, each of which have subplots

╄→尐↘猪︶ㄣ 提交于 2019-12-06 11:28:05
Problem I'm trying to combine two Python Plotly features. One of them is a drop down menu where a user can switch between plots ( link to examples ). The other feature is subplots. My attempt I have working code that uses the dropdown menu, but it doesn't have subplots. So I looked up how to create subplots here and I thought I could treat a tools.make_subplots figure the same way I treated a go.Box figure. I'm sorry if this seems naive, I'm actually fairly new to Plotly. However, this attempt is not working at all, I'm seeing two exceptions rise which I've put at the very bottom. My Working

Generate list of R plotly plots and pass it to subplot

こ雲淡風輕ζ 提交于 2019-12-06 10:29:34
问题 I usually generate subplots in a for loop when using base R graphics (using par(mfrow=c(nr,nc)) ). I'm trying to do something similar with plotly , by generating a series of plots and saving them to a list to be later passed to the subplot function. However, for reasons that I don't understand, at the end of the loop all the elements of the list seem to contain the same plot (the last one). If I print each plot in the list within the loop (uncommenting the line starting with print in the

On shiny app ggplotly() renders half the size of plot_ly(). How to fix that?

那年仲夏 提交于 2019-12-06 08:55:34
问题 A plot's width is less than half when using ggplotly vs plot_ly to generate a plotly in a shiny app. Why is that? Is there a way to fix it so that ggplotly produces the plot with the same width as plot_ly or ggplot2? I have tried using the width parameter but that doesn't fix it. Output from the shiny app: library(shiny) library(plotly) library(ggplot2) ui <- fluidPage( titlePanel("plotly with shiny"), mainPanel( h4("Using ggplotly:"), plotlyOutput("ggplotly", width = "200"), h4("Using native

Obtain observations in geom_hex in a single plot (Shiny)

≡放荡痞女 提交于 2019-12-06 07:59:00
问题 I am attempting to create an interactive plot of hexbins where a user can click on a given hexbin and receive a list of all observations of the original data frame that were grouped in that clicked hexbin. Below is a MWE that seems pretty close to my goal. I am using Shiny, hexbin(), and ggplotly. app.R library(shiny) library(plotly) library(data.table) library(GGally) library(reshape2) library(hexbin) ui <- fluidPage( plotlyOutput("plot"), verbatimTextOutput("click") ) server <- function

In plotly, how do I create a linked X axis?

旧巷老猫 提交于 2019-12-06 07:54:45
import matplotlib.pyplot as plt import numpy as np import plotly.plotly as py from plotly.graph_objs import * py.sign_in('uname', 'pass') trace1 = Scatter( x=[1,2,3,4,5,6,7,8], y=[24,25,30,21,33,31,30,29], mode='lines', xaxis='x1', ) layout = Layout( title="My first plot", yaxis=YAxis( title = "y1" ), xaxis=XAxis( title= 'x1', anchor = 'x2' ), xaxis2=XAxis( title= 'x2', side = 'top', overlaying = 'y' ), ) data = [trace1] fig = Figure(data=data, layout=layout) plot_url = py.plot(fig) I am trying to create a second X axis on the top of the plot (let's call it x2). I want it to be linked to x1

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

Plotly: How to combine make_subplots() and ff.create_distplot()?

纵饮孤独 提交于 2019-12-06 07:46:39
Creating multiple subplots using plotly is both easy and elegant. Consider the following example that plots two series from a dataframe side by side: Plot: Code: # imports from plotly.subplots import make_subplots import plotly.figure_factory as ff import plotly.graph_objs as go import pandas as pd import numpy as np # data np.random.seed(123) frame_rows = 40 n_plots = 6 #frame_columns = ['V_'+str(e) for e in list(range(1,n_plots+1))] frame_columns = ['V_1', 'V_2'] df = pd.DataFrame(np.random.uniform(-10,10,size=(frame_rows, len(frame_columns))), index=pd.date_range('1/1/2020', periods=frame

Is there a way to reverse the order of the y axis in heatmap of plotly

巧了我就是萌 提交于 2019-12-06 06:38:32
So I have hours = [x for x in range(7,18)] columns = [1, 2, 3, 4, 5] matrixDatos = [[0,1,0,1,0], [0,1,0,1,1], [2,3,2,3,2], [2,3,2,3,3], [4,5,4,5,4], [4,5,4,5,5], [6,7,6,7,6], [6,7,6,7,7], [8,9,8,9,8], [8,9,8,9,8] ] table = ff.create_table(matrixDatos) fig = ff.create_annotated_heatmap(matrixDatos, x=columns, y=hours, colorscale='Viridis') But it prints the heatmap with the y axis from 18 to 7 is there a way to print it from 7 to 18? Hi I tried the code provided, I was getting an error saying that number of Y-axis (hours) does not equal the number of Z-axis (matrixDatos). So I reduced the range

Creating Process Map Diagrams using different packages in R

て烟熏妆下的殇ゞ 提交于 2019-12-06 06:20:27
the given script simply creates a process map diagram showing the flow of events in R. This field of study is called event log mining or process mining. I wish to know any other packages or functionality in R using which I can create similar maps and also make them interactive like ggplotly. Please help me with some links if possible. Thanks and please help. library(bupaR) library(edeaR) library(eventdataR) library(processmapR) library(processmonitR) library(xesreadR) library(petrinetR) patients %>% process_map() 来源: https://stackoverflow.com/questions/46602433/creating-process-map-diagrams