Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plotly express plots have faded colors

I am having issues with plotly express in Jupyter notebook. The colors in the plot are faded and do not match the colors in the legend, which they are supposed to look like. Does anyone have any suggestions? Happy to provide more info, but I am not sure what would be useful - I am still new to Python.

enter image description here

fig = px.bar(funded_apps_mask_kewt, x='Grant Expended CY Quarter', y='Grant 
Expended Amount', color='AMI Status',title='Long-Form Input')
fig.update_xaxes(categoryorder='category ascending')
fig.show()


AMI Statu | Grant Exp | Grant Exp Q | Grant Exp Q | Grant Exp Year | Grant Exp QY
0 Very Low (50%)    20086.72 Q4 2020    Q4              2020           2020 Q4
1 Urgent Need (120%)20086.7  Q4 2020    Q4              2020           2020 Q4
2 Urgent Need (120%)20086.72 Q4 2020    Q4              2020           2020 Q4
3 Very Low (50%)    20086.72 Q4 2020    Q4              2020           2020 Q4
4 Low (80%)         20086.72 Q4 2020    Q4              2020           2020 Q4
5 Low (80%)         20086.72 Q4 2020    Q4              2020           2020 Q4
6 Low (80%)         20086.72 Q4 2020    Q4              2020           2020 Q4
82Low (80%)         35602.75 Q1 2021    Q1              2021           2021 Q1

This is what my data looks like. I changed the column names so they could fit, but the columns I used are 'AMI Status', 'Grant Exp', and 'Grant Exp QY'. It has ~7K rows.

like image 229
nateswill Avatar asked Feb 13 '21 03:02

nateswill


People also ask

What is the difference between plotly and Plotly Express?

Comparing Graph Objects and Plotly Express More complex figures such as sunbursts, parallel coordinates, facet plots or animations require many more lines of figure-specific graph objects code, whereas switching from one representation to another with Plotly Express usually involves changing just a few characters.

Is Plotly Express good?

Plotly Express is really cool. I would 100% recommend using it for exploratory data analysis. The interactivity of the plots allows you to do a much more thorough investigation of your data with ease.

What is Iplot plotly?

Plotly is a free and open-source graphing library for Python. We recommend you read our Getting Started guide for the latest installation or upgrade instructions, then move on to our Plotly Fundamentals tutorials or dive straight in to some Basic Charts tutorials.

Does plotly use SVG?

Each plotly trace type is primarily rendered with either SVG or WebGL, although WebGL-powered traces also use some SVG.


1 Answers

This is because of the bar outline, which can be removed by setting the marker.line.width attribute to 0:

fig.update_traces(dict(marker_line_width=0))
like image 130
Sviat Lavrinchuk Avatar answered Oct 19 '22 16:10

Sviat Lavrinchuk