plotly

create a bar chart using plotly

杀马特。学长 韩版系。学妹 提交于 2019-12-24 10:30:27
问题 I'm trying to create a bar chart using plotly . The input data looks like: In [7]: datag.ix[:,0].tolist()[1:6] Out[7]: [2020.0, 5000.0, 6010.0, 6017.0, 6020.0] and In [8]:datag.ix[:,1].tolist()[1:6] Out[8]: [0.005178087393490427, 0.0014053668695097226, 0.3174139251746979, 0.006049724003653125, 0.24824287385322272] and the code is import plotly import plotly.offline as offline import plotly.plotly as py import plotly.graph_objs as go trace1 = go.Bar( x=[str(x) for x in datag.ix[:,0].tolist()[1

R - Handle long labels in plotly

孤街浪徒 提交于 2019-12-24 09:48:41
问题 I have the following function with ggplot2 plot. One feature of the function is the str_wrap function call to handle the very long labels I have. PlotResponseRate <- function(EntryData) { PlotData <- as.data.frame(apply(X = EntryData, MARGIN = 2, function(x) round(length(which(!is.na(x)))/length(x)*100))) colnames(PlotData) <- "TheData" PlotData$TheLabel <- factor(str_wrap(colnames(EntryData), width = 30), levels = unique(str_wrap(colnames(EntryData), width = 30))) Graphe <- ggplot(data =

plotly cannot import name exceptions

﹥>﹥吖頭↗ 提交于 2019-12-24 09:48:34
问题 I know this question has been asked before but there are very few solutions given and I don't understand the ones that are provided . I'm trying to import my module packages and I receive the error below. The strange thing is this was all working 2 days ago and I haven't really done anything since with it so I can't understand why this is now appearing. import plotly.offline as pyo from plotly.graph_objs import * from plotly import tools import plotly.plotly as py import pandas as pd import

How to fix 'Dropdown Menu Read' Error in Plotly Dash

北战南征 提交于 2019-12-24 08:59:23
问题 I have tried to re-create the following example Towards Data Science Example shown on the web I have written the following code which I modified to this: 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 # Step 1. Launch the application app = dash.Dash() # Step 2. Import the dataset filepath = 'https://raw.githubusercontent.com/plotly/datasets/master/finance-charts

Add permanent shaded rectangle with select Box corners in Plotly R

守給你的承諾、 提交于 2019-12-24 08:48:00
问题 This is a continuation of a previous post (Add shaded rectangle with select Box corners in Plotly R). I am creating an application where if a user employs the Box Select tool in Plotly, then a filled rectangle will appear alongside the Box Select. This is currently working, as is shown in the MWE below: library(ggplot2) library(shiny) library(plotly) library(htmlwidgets) ui <- basicPage( plotlyOutput("plot1") ) server <- function(input, output) { p <- ggplot(mtcars, aes(x = wt, y = mpg)) +

factor not factorizing x axis labels for plotly

旧时模样 提交于 2019-12-24 07:25:09
问题 I have a dataframe imported from excel. one of the column is of the format : dates ------- Oct-17 Nov-17 Dec-17 Jan-18 Feb-18 Mar-18 Apr-18 May-18 Jun-18 Jul-18 Aug-18 All other columns are just numbers When I plot it using plotly (line chart), I am getting my x axis in alphabetical order. I tried factor.But it is not working. data_ = read_excel(path="Sample.xlsx",sheet = 'sheet1') data = as.data.frame(data_) data$dates <- factor(data$dates, levels = data$dates) What has to be done? Finally I

How to allow Duplicate Tick Labels in Plotly?

倖福魔咒の 提交于 2019-12-24 07:13:48
问题 I observed that while providing duplicate ticklabels (with an aim to mention the class of categorical variable), plotly creates a unique set and displays only the non-repeated tick labels. Is there a way to by-pass this feature and allow duplicate tick-labels? var data = [ { z: [[1, 20, 30, 50, 1], [20, 1, 60, 80, 30], [30, 60, 1, -10, 20]], x: ['Healthy', 'Healthy', 'Moderate', 'Diseased', 'Diseased'], y: ['Morning', 'Afternoon', 'Evening'], type: 'heatmap' } ]; Plotly.newPlot('myDiv', data)

Temporarily exclude points in plotly graph

徘徊边缘 提交于 2019-12-24 06:07:37
问题 In the following plotly example (taken from here), is it possible to introduce a function that allows the user to click on a point to 'grey it out', so it would be excluded from the 'active' dataset, and the loess fit line would automatically adjust to the new dataset? The point(s) could then be clicked again to bring them back into the 'active' data set. Could be tricky. As the comments suggest it will likely require shiny , but I’m having trouble figuring out how. library(plotly) library

plotly - different color scales for multiple surfaces

ε祈祈猫儿з 提交于 2019-12-24 03:12:34
问题 I am trying to use plotly (4.7.1) with R 3.4.1 to plot two 3D surfaces on the same plot, with two different color scales (variations of blue for one and variations of purple for the other one), and color values derived from z values. When I plot surfaces separately, it works pretty fine, but when I plot both surfaces on the same plot by using add_trace or add_surface, the second surface takes the color of the first one. Here is an example, using example code from https://plot.ly/r/3d-surface

plotly - different color scales for multiple surfaces

ε祈祈猫儿з 提交于 2019-12-24 03:12:12
问题 I am trying to use plotly (4.7.1) with R 3.4.1 to plot two 3D surfaces on the same plot, with two different color scales (variations of blue for one and variations of purple for the other one), and color values derived from z values. When I plot surfaces separately, it works pretty fine, but when I plot both surfaces on the same plot by using add_trace or add_surface, the second surface takes the color of the first one. Here is an example, using example code from https://plot.ly/r/3d-surface