plotly

Plotly addTraces/relayout giving different output than newPlot

…衆ロ難τιáo~ 提交于 2019-12-12 03:39:13
问题 I have a simple plot with two traces and two yaxis specs. When I plot them at the same time using newPlot I get the desired result. When I plot the traces (and layouts) one at a time, I get a different result, which is not what I want. With newPlot With addTraces / relayout https://jsfiddle.net/abalter/eatszatj/ Javascript: Plotly.newPlot("graph",[{}],{title: "Plot"}); trace1 = {y: [1,2,1]}; trace2 = { y: [0,0,0], yaxis: "y2", mode: "markers", marker: {symbol: 6, size: 12} }; yaxis1 = {domain

Plotly - starting X axis from first data point

瘦欲@ 提交于 2019-12-12 03:31:22
问题 In this plotly example, The first date is on the first of January, var trace1 = { x: ['2000-01-01', However, the first label shown on the graph is Jan 2. Is there a way to force the graph to start from the 1st of January? 回答1: You have several possibilities to specify the first tick value of your x-axis. Use tick0 together with dticks var layout = { xaxis: { tick0: '2000-01-01', dtick: 7*24*60*60*1000 // 7 days }; or completely set the tickvals yourself var layout = { xaxis: { tickvals: [

How to setup Plotly two horizontal subplots containing heatmaps so that they don't share a colorscale?

荒凉一梦 提交于 2019-12-12 02:18:26
问题 I have two heatmaps. Their values are in totally different scale, so should not share a colorscale. I tried to create a plotly figure w/ two subplots (arranged horizontally) and put each of my heatmaps into one of the subplot. However, the two heatmap shares the same colorscale to the right of the heatmap on the right. The colorscale show two sets of labels overlapped w/ each other. What I'd like to see is that there are two colorscales, one to the right of each heatmap. My code is below.

Open Pie Chart/Donut Chart in R using Plotly with count and percentage

此生再无相见时 提交于 2019-12-12 00:55:11
问题 I'm trying to make a donut chart in R using plotly. I tried ggplot, but it wasn't able to give me the effect that I need. Here's a sample dataset: library(dplyr) testfile <- tibble(personID = 1:10, status = c("bad", "good", "bad", "bad", "bad", "bad", "bad", "bad", "bad", "good"), department = c("sales", "sales", "marketing", "sales", "marketing", "management", "management", "sales", "sales", "sales")) This chart will end up in a PowerPoint, so it does not need to be responsive. Instead, I

How to change plotly legendstatus of trace n with a generic button + selectInput through javascript in R shiny

两盒软妹~` 提交于 2019-12-11 19:28:29
问题 Thanks to answers on this previous question, I have developed a plotly plot with buttons linked to its legend , where clicking the legend changes the state of a reactive variable containing T/F state for each of them, and thus re-renders the actionbuttons linked to each trace (data group). The other javascript does the same in opposite direction, clicking a button hides/shows that trace + legend item in the plot . Now i'm hoping to add another interaction through a new button + selectinput

R plotly plot_ly function: axis titles don't appear when I call plotly inside a project

南笙酒味 提交于 2019-12-11 18:48:38
问题 I am using R3.4.0 and I am developing under RStudio in Windows 10 in the form of a project to produce a package. I don't understand why the titles of the axes don't appear. I don't even have an error message. Version 1: #' TestPlotly #' @export #' @importFrom plotly plot_ly TestPlotly=function() { p<-plot_ly(x = 1:10, y = 1:10,xaxis=list(title="tr"),yaxis=list(title="ts"),type="scatter",mode="lines") print(p) } NB: I get the same problem with this code kindly suggested by somebody: #'

How to make the column widths of a grouped heatmap all the same in ggplotly()

五迷三道 提交于 2019-12-11 18:38:51
问题 I have this data frame: gene_symbol<-c("DADA","SDAASD","SADDSD","SDADD","ASDAD","XCVXCVX","EQWESDA","DASDADS","SDASDASD","DADADASD","sdaadfd","DFSD","SADADDAD","SADDADADA","DADSADSASDWQ","SDADASDAD","ASD","DSADD") panel<-c("growth","growth","growth","growth","big","big","big","small","small","dfgh","DF","DF","DF","DF","DF","gh","DF","DF") ASDDA<-c("normal","over","low","over","normal","over","low","over","normal","over","DF","DF","DF","DF","DF","DF","DF","DF") ASDDb<-c("normal","over","low",

Interactive plot with Slider using Plotly

十年热恋 提交于 2019-12-11 18:38:41
问题 How do I recreate the following interactive plot in Python using Plotly? My simple example draws a bar chart with one column x and another 1-x. GIF from Mathematica: Slider allows for a varying x between 0 and 1. Mathematica code: Manipulate[BarChart[{x, 1 - x}, PlotRange -> {0, 1}], {{x, 0.3, "Level"}, 0, 1, Appearance -> "Open"}] UPDATE Here is a solution which I don't like: import plotly.graph_objs as go from plotly.offline import init_notebook_mode, iplot init_notebook_mode(connected=True

Plotly ggplot stacked bar chart disappear when legend is clicked

杀马特。学长 韩版系。学妹 提交于 2019-12-11 18:15:51
问题 I'm not sure why but my stacked bar chart disappears instead of falling to the axis when the legend is clicked. I've attached a screenshot of the example that I copied from the plotly website and the code are as follows: library(plotly) DF <- read.table(text="Rank F1 F2 F3 1 500 250 50 2 400 100 30 3 300 155 100 4 200 90 10", header=TRUE) library(reshape2) DF1 <- melt(DF, id.var="Rank") p <- ggplot(DF1, aes(x = Rank, y = value, fill = variable)) + geom_bar(stat = "identity") p <- ggplotly(p)

Dash output with multiple inputs

僤鯓⒐⒋嵵緔 提交于 2019-12-11 17:42:42
问题 I am trying to have a dash component properly input variables and give appropriate output. Currently multiple inputs will make the functionality not work. I've put multi=true for my dcc dropdown - hasn't worked successfully yet. This is the code I have used. import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import pandas as pd import plotly.graph_objs as go df = pd.read_excel('FreewayFDSData.xlsx', 'Volume', parse