plotly

Plotly: How to change the colorscheme of a plotly express scatterplot?

瘦欲@ 提交于 2020-12-01 10:49:11
问题 I am trying to work with plotly, specifically ploty express, to build a few visualizations. One of the things I am building is a scatterplot I have some code below, that produces a nice scatterplot: import plotly.graph_objs as go, pandas as pd, plotly.express as px df = pd.read_csv('iris.csv') fig = px.scatter(df, x='sepal_length', y='sepal_width', color='species', marker_colorscale=px.colors.sequential.Viridis) fig.show() However, I want to try and change the colorscheme, i.e., the colors

Plotly: How to change the colorscheme of a plotly express scatterplot?

喜夏-厌秋 提交于 2020-12-01 10:48:57
问题 I am trying to work with plotly, specifically ploty express, to build a few visualizations. One of the things I am building is a scatterplot I have some code below, that produces a nice scatterplot: import plotly.graph_objs as go, pandas as pd, plotly.express as px df = pd.read_csv('iris.csv') fig = px.scatter(df, x='sepal_length', y='sepal_width', color='species', marker_colorscale=px.colors.sequential.Viridis) fig.show() However, I want to try and change the colorscheme, i.e., the colors

Change Color of an Entire Trace on Hover/Click in Plotly

二次信任 提交于 2020-11-29 10:19:19
问题 I have the current figure in plotly (jupyter notebook code below), and was hoping to create the effect whereby when you hover or click over each trace, the whole trace is highlighted a different colour (in this example red). I tried implementing these examples from SOF: Plotly in Python: how to highlight a trace on hover? & How do I highlight an entire trace upon hover in Plotly for Python? with no luck. If anyone could help that would be amazing. Currently each trace remains lightgrey.

Change Color of an Entire Trace on Hover/Click in Plotly

懵懂的女人 提交于 2020-11-29 10:15:29
问题 I have the current figure in plotly (jupyter notebook code below), and was hoping to create the effect whereby when you hover or click over each trace, the whole trace is highlighted a different colour (in this example red). I tried implementing these examples from SOF: Plotly in Python: how to highlight a trace on hover? & How do I highlight an entire trace upon hover in Plotly for Python? with no luck. If anyone could help that would be amazing. Currently each trace remains lightgrey.

Plotly Dash - Gradient Lines

可紊 提交于 2020-11-29 09:39:05
问题 Is it possible using Plotly Dash to create line graphs in which the line colors are gradient (purely for aesthetics) ? I tried using something like 'line': {'color': 'linear-gradient(90deg, red, red 60%, white)' } example of entire graph code in plotly dassh dcc.Graph( id='MORTGAGE_RATES', figure={ 'data': [ { "x": MORTGAGE30US['date'],"y": MORTGAGE30US['value'],"mode": "lines","name": '30 YR', 'line': {'color': 'linear-gradient(90deg, red, red 60%, white)' }}, { "x": MORTGAGE15US['date'],"y"

How to add points to line chart using plotly express?

痞子三分冷 提交于 2020-11-29 04:47:07
问题 plotly.express is very convenient to produce nice interactive plots. The code below generates a line chart colored by country. Now what I need is to add points to the plot. Does anyone know how I can add points to the line chart? import plotly.express as px gapminder = px.data.gapminder().query("continent=='Oceania'") fig = px.line(gapminder, x="year", y="lifeExp", color='country') fig.show() 回答1: Use fig.update_traces(mode='markers+lines') Plot: Code: import plotly.express as px gapminder =

How to add points to line chart using plotly express?

筅森魡賤 提交于 2020-11-29 04:46:27
问题 plotly.express is very convenient to produce nice interactive plots. The code below generates a line chart colored by country. Now what I need is to add points to the plot. Does anyone know how I can add points to the line chart? import plotly.express as px gapminder = px.data.gapminder().query("continent=='Oceania'") fig = px.line(gapminder, x="year", y="lifeExp", color='country') fig.show() 回答1: Use fig.update_traces(mode='markers+lines') Plot: Code: import plotly.express as px gapminder =

Plotly: How to make a figure with multiple lines and shaded area for standard deviations?

霸气de小男生 提交于 2020-11-24 18:02:28
问题 How can I use Plotly to produce a line plot with a shaded standard deviation? I am trying to achieve something similar to seaborn.tsplot. Any help is appreciated. 回答1: The following approach is fully flexible with regards to the number of columns in a pandas dataframe and uses the default color cycle of plotly. If the number of lines exceed the number of colors, the colors will be re-used from the start. As of now px.colors.qualitative.Plotly can be replaced with any hex color sequence that

Plotly: How to make a figure with multiple lines and shaded area for standard deviations?

心已入冬 提交于 2020-11-24 17:58:58
问题 How can I use Plotly to produce a line plot with a shaded standard deviation? I am trying to achieve something similar to seaborn.tsplot. Any help is appreciated. 回答1: The following approach is fully flexible with regards to the number of columns in a pandas dataframe and uses the default color cycle of plotly. If the number of lines exceed the number of colors, the colors will be re-used from the start. As of now px.colors.qualitative.Plotly can be replaced with any hex color sequence that