plotly

Plotting 3 pie charts side-by-side using the domain property

爷,独闯天下 提交于 2019-12-11 17:22:04
问题 I am trying to plot 3 pie charts side by side. I don't understand why the following code is making the pie charts go across the page diagonally left to write rather than horizontally left to write in one line. Here's my code: app.layout = html.Div([ html.Div([ dcc.Graph(id='TPiePlot', figure={ 'data': [go.Pie(labels=labels1, values=values1, marker=dict(colors=colors, line=dict(color='#fff', width=1)), hoverinfo='label+value+percent', textinfo='value', domain={'x': [0, .25], 'y': [0, 1]} ) ],

Plotly Express hovermode with arbitrary column

我与影子孤独终老i 提交于 2019-12-11 17:13:52
问题 I see that the hovermode attribute in layout has options for x or y , but is it possible to use an arbitrary dataframe column? instead? For example, I'm plotting precision-recall curves. The x-axis is recall, and the y-axis is precision. The independent variable is a detection threshold value (with range of np.linspace(0,1.0,101) ) with a column in my dataframe called threshold . When I hover over a precision-recall point, what I'm interested in is points on other curves with the same

Plotly.js setting timezone for type:“date”

江枫思渺然 提交于 2019-12-11 16:51:26
问题 I'm working on a graph to display a status over time. All the data is in unix formatting. I display the data in my title using javascript (new Date(data)).toUTCString . This is the same data used for the graph but the graph is running 1 hour early. Image Here is my layout config: layout = { "showlegend": true, "title": new Date(min).toUTCString() + " to " + new Date(max).toUTCString(), "xaxis": { "autorange": true, "range": [ min, max ], "title": "Time", "type": "date" //if I change this to

How to convert a ggplot to plot_ly?

折月煮酒 提交于 2019-12-11 16:07:21
问题 I am trying to create a Shiny Dashboard which contains Plots also. Plotly is such a great a package that it provides great visualization and interactivity to the users. I know that the best way to convert a ggplot to plotly is by using the ggplotly() function. But when i am using the ggplotly, i am facing issues on the size and appearance of the plots in the dashboard. I had requested a question on this before (ggplotly not working properly when number are facets are more ) and also i tried

Plotly: how to specify symbol and color based on value?

心不动则不痛 提交于 2019-12-11 15:16:47
问题 When plotting with plotly in R, how does one specify a color and a symbol based on a value? For example with the mtcars example dataset, how to plot as a red square if mtcars$mpg is greater or less than 18? For example: library(plotly) p <- plot_ly(type = "scatter", data = mtcars, x = rownames(mtcars), y = mtcars$mpg, mode = "markers" ) How to get all points above 20 as yellow squares? 回答1: you could do something like this: plot_ly(type = "scatter", data = mtcars, x = rownames(mtcars), y =

Plotly Waterfall Chart Stacked in Python

為{幸葍}努か 提交于 2019-12-11 15:15:51
问题 All, I can create a nice little waterfall chart using the code below. However, I would like to be able to split the data to show contributions to that specific metric. For example I would like to split the waterfall bars by Local and International. ie. the Sales would have both Local and International adding up to the total. Can this be done. import plotly.graph_objects as go fig = go.Figure(go.Waterfall( name = "20", orientation = "v", measure = ["relative", "relative", "total", "relative",

Plotly boxplot: groupby option?

限于喜欢 提交于 2019-12-11 14:50:36
问题 I have two boolean variables and I try to create a boxplot with groups. Each group should represent one of the variables and it should contain two boxplots, one for TRUE and one for FALSE. Instead I am getting two groups, one representing TRUE and one representing FALSE and for each group two boxplots corresponding to each variable as in the attached graph: I understand that groups are derived from the xaxis. But how can I make plotly think that the variable names are the groups? The code I

number instead of date on the density plot in R

不羁的心 提交于 2019-12-11 14:46:27
问题 I have a problem. I am trying to draw a density plot in R with the plotly package. But when I hover the mouse over the plot I get number format of date 17623 instead 2018-04-02. Any ideas how to solve this problem? Date <- seq(as.Date(Sys.Date()-30), by=1, len=31) Value <- runif(31) dataTable <- data.frame(Date, Value) density_plot = ggplot(dataTable, aes(x=Date, y = Value)) + geom_density(stat="identity", fill = "#4156C5") + labs(fill = "Value", x = "Date", y = "Frequency") ggplotly(density

Subset a dataframe based on plotly click event

本小妞迷上赌 提交于 2019-12-11 14:25:36
问题 I have the data frame below: Name<-c("John","Bob","Jack") Number<-c(3,3,5) NN<-data.frame(Name,Number) And a simple shiny app which creates a plotly histogram out of it. My goal is to click on a bar of the histogram and display the Name in a datatable that correspond to this bar. For example if I click on the first bar which is 3 I will take a table with John and Bob names. library(plotly) library(shiny) library(DT) ui <- fluidPage( mainPanel( plotlyOutput("heat") ), DT::dataTableOutput('tbl4

X-axis gets hidden in Plotly - R

不羁岁月 提交于 2019-12-11 13:55:18
问题 I am using plotly. Every graph that I make, has x-axis half hidden. It happens even if I use variables of x-axis as y-axis. For example, consider the following dataset: structure(list(City = c("MUMBAI", "DELHI", "KOLKATTA", "HYDERABAD", "PUNE", "BANGALORE", "AHMEDABAD", "LUCKNOW", "AGRA", "BHUBANESHWAR", "GUWAHATI", "NAGPUR", "DELHIN.C.R", "MANGALORE", "INDORE"), OppLoss = c(48, 44, 41, 38, 56, 43, 44, 43, 42, 32, 31, 43, 47, 25, 41)), .Names = c("City", "OppLoss"), row.names = c(32L, 13L,