plotly

Add index as dropdown menu in plotly

拥有回忆 提交于 2021-02-05 06:39:47
问题 I am plotting chart using below code: fig = px.line(df, x='Time', y=['one','two'], color= df.index) fig['layout']['xaxis']['autorange'] = "reversed" fig.update_layout(legend_title="Price") fig.show() Dataframe i am working with like is below: Time one two 100 9:30 129 243 110 10:30 234 453 120 11:00 155 234 Want to add dropdown menu to select from index and show one row at a time in chart. example if i select 110 from drop down it should only show chart for that row. Is there any easy fix for

Add title to the plotly legend

一个人想着一个人 提交于 2021-02-04 22:20:07
问题 In the following example how can i add a title to the legend in plot_ly for R ? mtcars %>% plot_ly(x = ~disp, y = ~mpg, color = ~factor(cyl), size = ~wt) %>% add_markers( hoverinfo = "text", text = ~paste("Displacement = ", disp, "\nMiles Per Gallon = ", mpg) ) %>% layout(title ="Custom Hover Text") thanks 回答1: The only way I know is to use an annotation and add it to the plot. Like this: legendtitle <- list(yref='paper',xref="paper",y=1.05,x=1.1, text="Cylinders",showarrow=F) mtcars %>% plot

How to color ticktext in plotly?

只愿长相守 提交于 2021-02-04 19:15:26
问题 I would like to display my ticktexts in my plotly xaxis with different colors based on the respective string (based on a dictionary). Is there a functionality in plotly to do this, maybe via HTML coding? ticktext = ['<font color="red">{}</font> '.format(x) for x in ticktexts] doesn't work, it gives the html string to the labels. 回答1: A little bit of a workaround using LaTeX can help you here (sorry @Iwileczek, I stole your example, hope you don't mind) because plotly has full LaTeX support:

How to color ticktext in plotly?

末鹿安然 提交于 2021-02-04 19:15:13
问题 I would like to display my ticktexts in my plotly xaxis with different colors based on the respective string (based on a dictionary). Is there a functionality in plotly to do this, maybe via HTML coding? ticktext = ['<font color="red">{}</font> '.format(x) for x in ticktexts] doesn't work, it gives the html string to the labels. 回答1: A little bit of a workaround using LaTeX can help you here (sorry @Iwileczek, I stole your example, hope you don't mind) because plotly has full LaTeX support:

Plotly chart not showing in Jupyter notebook

大城市里の小女人 提交于 2021-02-04 11:10:20
问题 I have been trying to solve this issue for hours. I followed the steps on the Plotly website and the chart still doesn't show in the notebook. This is my code for the plot: colorway = ['#f3cec9', '#e7a4b6', '#cd7eaf', '#a262a9', '#6f4d96', '#3d3b72', '#182844'] data = [ go.Scatter( x = immigration.columns, y = immigration.loc[state], name=state) for state in immigration.index] layout = go.Layout( title='Immigration', yaxis=dict(title='Immigration %'), xaxis=dict(title='Years'), colorway

Plotly chart not showing in Jupyter notebook

雨燕双飞 提交于 2021-02-04 11:08:35
问题 I have been trying to solve this issue for hours. I followed the steps on the Plotly website and the chart still doesn't show in the notebook. This is my code for the plot: colorway = ['#f3cec9', '#e7a4b6', '#cd7eaf', '#a262a9', '#6f4d96', '#3d3b72', '#182844'] data = [ go.Scatter( x = immigration.columns, y = immigration.loc[state], name=state) for state in immigration.index] layout = go.Layout( title='Immigration', yaxis=dict(title='Immigration %'), xaxis=dict(title='Years'), colorway

R: Plot Axis Display Values Larger than the Original Data

限于喜欢 提交于 2021-02-04 08:27:07
问题 I am using the R programming language. I am following a tutorial on data visualization over here: https://plotly.com/r/3d-surface-plots/ I created my own data and made a 3D plot: library(plotly) set.seed(123) #generate data a = rnorm(100,10,10) b = rnorm(100,5,5) c = rnorm(100,5,10) d = data.frame(a,b,c) #3d plot fig <- plot_ly(z = ~as.matrix(d)) fig <- fig %>% add_surface() #view plot fig As seen here, there is a point on this 3D plot where "y = 97". I am not sure how this is possible,

Use Dash (plot.ly) in PyQt5 GUI

核能气质少年 提交于 2021-02-04 07:53:21
问题 I am running into a problem while trying to create a dashboard with Dash (plotly), while using a GUI created with PyQt5. I have tried to have the following example code both as a module and at the end of my code: import dash import dash_core_components as dcc import dash_html_components as html def run_dash(data, layout): app = dash.Dash() app.layout = html.Div(children=[ html.H1(children='Hello Dash'), html.Div(children=''' Dash: A web application framework for Python. '''), dcc.Graph( id=

Change subplots title position/orientation in Plotly Python

安稳与你 提交于 2021-02-04 07:24:49
问题 I need to change subplot title in python plotly, namely, rotate it by 90 degrees. I tried hard but without any success. Here is my code import plotly.offline as pyo import plotly.graph_objs as go from plotly import tools trace1 = go.Bar( x=[1, 2, 3], y=[10, 11, 12] ) trace2 = go.Bar( x=[1, 2, 3], y=[100, 110, 120], ) trace3 = go.Bar( x=[1, 2, 3], y=[1000, 1100, 1200], ) fig = tools.make_subplots(rows=1, cols=3, shared_xaxes=True, shared_yaxes=True, vertical_spacing=0.001, subplot_titles = (

Change subplots title position/orientation in Plotly Python

烈酒焚心 提交于 2021-02-04 07:24:24
问题 I need to change subplot title in python plotly, namely, rotate it by 90 degrees. I tried hard but without any success. Here is my code import plotly.offline as pyo import plotly.graph_objs as go from plotly import tools trace1 = go.Bar( x=[1, 2, 3], y=[10, 11, 12] ) trace2 = go.Bar( x=[1, 2, 3], y=[100, 110, 120], ) trace3 = go.Bar( x=[1, 2, 3], y=[1000, 1100, 1200], ) fig = tools.make_subplots(rows=1, cols=3, shared_xaxes=True, shared_yaxes=True, vertical_spacing=0.001, subplot_titles = (