I am making plotly.express graphs in a Jupyter Notebook. I have been able to make a histogram plot with a dark theme that looks alright:
Here’s the code I used for making the Histogram
# Use plotly to make it interactive
fig = px.histogram(
data_frame=df,
x='Score',
color='Score',
color_discrete_sequence=px.colors.qualitative.Set3,
opacity=0.7, # Transparency of bars
title='Food Review Counts by Ratings',
labels={'Score': 'Rating'}, # Axis labels
template='plotly_dark', # Dark theme
)
# Adjust layout for better appearance
fig.update_layout(
bargap=0.2, # Gap between bars
xaxis=dict(tickmode='linear'), # Linear tick marks on x-axis
yaxis=dict(title='Counts'),
showlegend=True
)
# Show the plot
fig.show()
Now when I try to make a bar graph, the colors seem to be too dark/dim
This is the code I used for making the bar graph:
# Make an interactive bar chart
fig = px.bar(data_frame=vaders, x='Score', y='compound',
title='Compound Score by Ratings',
labels={'Score': 'Rating'},
color='Score',
color_continuous_scale='Viridis'
template='plotly_dark'
)
# Figure layout
fig.update_layout(
bargap=0.2,
xaxis=dict(tickmode='linear'),
yaxis=dict(title='Compound'),
showlegend=True,
)
fig.show()
Removing the dark theme doesn’t make the colors stand out either, they’re too light.
Any idea how to fix the colors and make them stand out?