plotly

How to sort plotly stacked bar graph in r by y value?

亡梦爱人 提交于 2020-03-26 04:04:56
问题 I've got this graph and I want it to appear in Sam - Jhon - Paul order because that's going from highest to lowest cost, somebody could tell me how to order it by cost? Tried using code below in layout section but it didn't word. layout(yaxis = list(title = 'Cost'), xaxis = list(title = 'Parent', categoryorder = "array", categoryarray = ~cost), barmode = 'stack') 回答1: You are almost there. You just need to use the order of top_3$parent in your categoryarray instead of cost , as follows:

filled 3D histogram from 2D histogram with plotly

与世无争的帅哥 提交于 2020-03-25 18:43:42
问题 I have done a graph with the exact code posted here. It is almost exactly what I want but I would like the 2D histogram slices to be filled and not just a line. Therefore, I add the parameter surfaceaxis=0 as I found in this example. The image I get is the following: I see that the code kind of "tries" to do what I want but not quite. I tried other options like go.Surface or go.Isosurface but didn't work. My code: # imports import numpy as np import pandas as pd import plotly.express as px

filled 3D histogram from 2D histogram with plotly

给你一囗甜甜゛ 提交于 2020-03-25 18:41:02
问题 I have done a graph with the exact code posted here. It is almost exactly what I want but I would like the 2D histogram slices to be filled and not just a line. Therefore, I add the parameter surfaceaxis=0 as I found in this example. The image I get is the following: I see that the code kind of "tries" to do what I want but not quite. I tried other options like go.Surface or go.Isosurface but didn't work. My code: # imports import numpy as np import pandas as pd import plotly.express as px

Plotly: How to format text (underline, bold, italic)

冷暖自知 提交于 2020-03-23 23:52:48
问题 I try to underline text in plotly when using annotations. I add my annotations using import plotly.graph_objects as go g = go.FigureWidget(make_subplots(rows=1,cols=1)) g.update_layout(annotations=[dict(text='my text')]) #plus any other parameters Is there an option (in the annotations dict, maybe?) to have underlined text? Thanks! 回答1: Plotly uses a subset of HTML tags to format text like bold '<b></b>' and italics '<i></i>' . Alas, '<u></u>' does not seem to be included at the moment. But

Plotly: How to format text (underline, bold, italic)

只愿长相守 提交于 2020-03-23 23:52:26
问题 I try to underline text in plotly when using annotations. I add my annotations using import plotly.graph_objects as go g = go.FigureWidget(make_subplots(rows=1,cols=1)) g.update_layout(annotations=[dict(text='my text')]) #plus any other parameters Is there an option (in the annotations dict, maybe?) to have underlined text? Thanks! 回答1: Plotly uses a subset of HTML tags to format text like bold '<b></b>' and italics '<i></i>' . Alas, '<u></u>' does not seem to be included at the moment. But

How to enable and disable the logarithmic scale as a viewer in Plotly?

依然范特西╮ 提交于 2020-03-23 21:40:29
问题 I am recently exploring Plotly and I wonder if there is a way for sharing a plot and let the viewer switch between a logarithmic axis and linear axis. Any suggestion? 回答1: Plotly has a dropdown feature which allows the user to dynamically update the plot styling and/or the traces being displayed. Below is a minimal working example of a plot where the user can switch between a logarithmic and linear scale. import plotly import plotly.graph_objs as go x = [1, 2, 3] y = [1000, 10000, 100000] y2

Plotly: How to make a 3D stacked histogram?

…衆ロ難τιáo~ 提交于 2020-03-23 04:04:31
问题 I have several histograms that I succeded to plot using plotly like this: fig.add_trace(go.Histogram(x=np.array(data[key]), name=self.labels[i])) I would like to create something like this 3D stacked histogram but with the difference that each 2D histogram inside is a true histogram and not just a hardcoded line (my data is of the form [0.5 0.4 0.5 0.7 0.4] so using Histogram directly is very convenient) Note that what I am asking is not similar to this and therefore also not the same as this

Plotly: How to make a 3D stacked histogram?

僤鯓⒐⒋嵵緔 提交于 2020-03-23 04:03:19
问题 I have several histograms that I succeded to plot using plotly like this: fig.add_trace(go.Histogram(x=np.array(data[key]), name=self.labels[i])) I would like to create something like this 3D stacked histogram but with the difference that each 2D histogram inside is a true histogram and not just a hardcoded line (my data is of the form [0.5 0.4 0.5 0.7 0.4] so using Histogram directly is very convenient) Note that what I am asking is not similar to this and therefore also not the same as this

Plotly.io doesn't see the psutil package even though it's installed

☆樱花仙子☆ 提交于 2020-03-22 23:13:10
问题 I'm trying to execute the following code: import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib %matplotlib inline import seaborn as sns import plotly.graph_objects as go from plotly.offline import init_notebook_mode, iplot init_notebook_mode(connected=True) from sklearn.preprocessing import QuantileTransformer import os if not os.path.exists("images"): os.mkdir("images") # import orca import plotly.io as pio pio.orca.config.executable = '/path/to/orca' pio

How to remove empty factors from xaxis

 ̄綄美尐妖づ 提交于 2020-03-22 08:48:14
问题 Trying to make interactive plotly barchart with filter_select() and no-shiny work. I am working with data for a lot of airports (> 100). A barchart is typically too crowded to support the user to compare the performance observed (value VAL) at one airport (APT_x) to a subset of peers. The idea is to use a filter to have the user select the subset of airports. # create a dummy table with data for year, airport, and oberved value yr <- c(2017, 2018, 2019) ap <- c("APT_1", "APT_2", "APT_3", "APT