plotly

Plotly.py: fill to zero, different color for positive/negative

我的未来我决定 提交于 2019-12-13 03:31:06
问题 With Plotly, I can easily plot a single lines and fill the area between the line and y == 0 : import plotly.graph_objects as go fig = go.Figure() fig.add_trace(go.Scatter( x=[1, 2, 3, 4], y=[-2, -1.5, 1, 2.5], fill='tozeroy', mode='lines', )) fig.show() How can I split the filled area in two? In particular, filling with red where y < 0 and with green where y > 0 . I would like to maintain the line as continuous. That means, I am not interested in just drawing two separate filled polygons.

Customizing text (text size, text color, text angle) in Plotly for R

隐身守侯 提交于 2019-12-13 03:29:39
问题 I'm working on making a donut chart/open pie chart in Plotly. Because of help from this question, Open Pie Chart/Donut Chart in R using Plotly with count and percentage, I was able to get fairly far with my plot. However, now I need help customizing the text size, angle, and color. Here's the 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",

Counting the number of bars in a grouped bar chart in R and plotly

末鹿安然 提交于 2019-12-13 03:13:38
问题 When I run this script below, It gives me two grouped bar charts. I simply want a vector with the count of number of bars in each group. Attaching the snapshot for reference, clearly, the vector will have two count values. Please help. library(shiny) library(shinydashboard) library(ggplot2) library(plotly) ui <- dashboardPage( dashboardHeader(title = "Sankey Chart"), dashboardSidebar( width = 0 ), dashboardBody( fluidRow( column(10, uiOutput('box1'), tags$br()), tags$br(), column(10, box

Ordered bars on plotly

╄→尐↘猪︶ㄣ 提交于 2019-12-13 02:35:52
问题 I'm trying to make a CPU Usage graph with Plotly and R, I want the max usage (100%, the blue bar) on top, and the other one on bottom, but when I try this code plot_ly( x = cores, y = max, type = 'bar', name = 'Free') %>% add_trace( y = data, name = 'Used') %>% layout( title = "CPU Usage", font = list(family = 'Comic Sans MS'), yaxis = list(title = 'Percent'), xaxis = list(title = '', tickangle = -45), barmode = 'stack') }) It gives me the reverse, ordering the greater bar on bottom, and the

Creating an Enviroment for plotly and matplotlib in python 2.7

谁说胖子不能爱 提交于 2019-12-13 01:05:39
问题 I managed to install on my conda the plotly package with: conda install -c plotly plotly And the matplotlib with: conda create --name mpl33 python=3.3 matplotlib ipython-notebook But I cant create one env with both of them inside because the plotly uses python 2.7 and matplotlib python 3.3 Thanks for the help! 回答1: Installation If you create a new environment, I would recommend using a new python version. Currently, I'd use python 3.6, because matplotlib does not support python 3.3 anymore.

Seaborn heatmap to plotly failed

允我心安 提交于 2019-12-13 00:55:07
问题 I'm having plotly error when converting seaborn.heatmap figure to plotly. I'm doing that in jupyter notebook with following code: %matplotlib inline import numpy as np import seaborn as sns import matplotlib.pyplot as plt from plotly.offline import init_notebook_mode, iplot_mpl init_notebook_mode(connected=True) np.random.seed(2017) data = np.random.randn(10, 20) When I'm plotting it as static seaborn heatmap everything is alright: sns.heatmap(data) But when I'm trying to convert that object

plotly.figure_factory.create_scatterplot stopped working?

可紊 提交于 2019-12-13 00:19:54
问题 I was using plotly to try some things and then found that create_scatterplot is the only package that doesn't work. I mean, it clearly is in the module, as it appears when you call the help command: NAME plotly.figure_factory FILE /usr/lib/python2.7/site-packages/plotly/figure_factory/__init__.py PACKAGE CONTENTS _2d_density _annotated_heatmap _bullet _candlestick _county_choropleth _dendrogram _distplot _facet_grid _gantt _ohlc _quiver _scatterplot _streamline _table : And in the plotly.py

How to resolve ggplotly error using color fill

孤街醉人 提交于 2019-12-12 22:27:26
问题 Using the ggplotly call extending from ggplot2, I'm trying to add an outline to the points. The call to ggplot works, but extending the call to ggplotly yields an error. The objective is the have an interactive plot with color filled points based on a continuous variable with a black outline (using pch =21 in this case). Minimal reproducible example: library(ggplot2) library(plotly) ggplot(data=mtcars, aes(mpg, wt, fill=hp))+geom_point(pch=I(21))+scale_fill_continuous(low='red', high='blue')

how to make a plotly legend span two columns

北战南征 提交于 2019-12-12 21:50:15
问题 I am plotting a comparison of lots of data using a plotly graph. The strings describing each line tend to get long, so I need to make them multiline. However, with many plots, the legend can run off the screen. I would like to split the legend into two columns. Is there a way to do this in plotly? Looking at help(plotly.graph_objs.Legend) there is no ncol or similar argument as matplotlib has, and I can't find any reference to this in the plotly documentation. Here is some example code:

Adding additional label value when clicked on Sankey Chart lines in R shiny

允我心安 提交于 2019-12-12 21:25:43
问题 The following R shiny script creates a sankey chart as in the snapshot below. My requirement is that when I click on any link between the nodes on left and right i.e. "a1" and "a2", I want the total sum of corresponding "a3" to be present in the label. For Illustration, "A" in a1 and "E" in a2 together have value 50 and 32. So, I want to see 82 in the label when clicked on link, please help and thanks. Similary for all other a1,a2 pairs. Some tweak is needed in the list() function in server