I have the following pandas dataframe:
import random
import pandas as pd
random.seed(42)
so = pd.DataFrame({'x': random.sample(range(1, 100), 40),
'group': ['a']*10+['b']*10+['c']*10+['d']*10})
from so I calculate the…
Let's take a simple example:
import plotly.express as px
x = ['A', 'B']
y = [10, 20]
fig = px.bar(x=x, y=y, color=x)
fig.update_layout(autosize=False, width=300, height=300, showlegend=True)
fig.show()
I set the width ad height to the same value,…
I'd to plot a simple line plot but if I have more than 10 variables, plolty use the same color twice, how can I avoid it and always have a new color for a new variable ?
import pandas as pd
import numpy as np
pd.set_option("plotting.backend",…
I'm new in Dash. I'm trying to use a daq.BooleanSwitch() like an input to callback a graph. I can display a message but I have troubles with the graph.
Does anyone have any advice that can help me?
import dash
from dash.dependencies import Input,…
When creating custom hovercards in plotly express via the custom_data/hovertemplate paradigm, the color is shown to the right of it. For example, here shows "blue" just to the right of "a=1". How can I remove the "blue"?
import pandas as pd
import…
I'd like to remove the tick labels from my secondary y-axis, while leaving the tick labels from the primary y-axis.
fig.add_trace(go.Scatter(x=df.index, y=df['A'],
line=dict(color='rgba(255, 255, 0, 0.25)',…
I'm trying to plot trendlines on multiple traces on scatters in plotly. I'm kind of stumped on how to do it.
fig = go.Figure()
fig.add_trace(go.Scatter(x=df_df['Circumference (meters)'],
y=df_df['Height (meters)'],
…
I’m trying to create a bar chart like the image below:
And I'm almost there, but I'm not finding any reference about setting a border style dashed or dotted;
Below is a picture of the chart created by me:
I will add a minimal reproducible code…
I followed the answer from @PythononToast How can I add a button or dropdown in a plot created using Plotly in Python? The plot first generated is correct, but values changed after clicking the drop-down filter. As we can see from the plot he…
I have gone through this, this and some other similar posts. They all give the solution in javascript which I am unable to port to python. Help would be appreciated.
When I pass a value to customdata which is big enough to be a billion, it shows the…
In the image below, the hoverlabel shows the percent proportionate values. I would rather it show the actual value of each continent on that particular date. I am not sure how to make it happen. For clarity,
Asia would be 9 instead of 37.5, North…
I can turn off the modebar in plotly by passing displayModeBar: False as the value of config in fig.show(), like this-
import plotly.express as px
df = px.data.stocks()
fig = px.line(df, x='date',…
Is there a way to move the Plotly-plot's xtick labels to "top" of the plot
and ytick labels to the "right" of the plot?
In the above plot, I basically want to move the xtick labels to top, and ytick labels to the right. I know this is not the…