Black Lives Matter. Please consider donating to Black Girls Code today.
https://www.blackgirlscode.com

How do i remove the faint horizontal lines and have it as one block in my bar?

hi all,

Screenshot 2020-06-25 at 5.42.41 PM

i have the above data, i then use the follwing code:

> import plotly.graph_objs as go
> df = df.melt(id_vars=["year", "risk"], value_vars=["predicted", "actual"])
> fig = go.Figure()
> 
> for risk in ["low", "medium", "high"]:
>     tmp_df = df.query(f"risk == '{risk}'")
>     fig.add_trace(
>         go.Bar(
>             x=[tmp_df["year"], tmp_df["variable"]], y=tmp_df["value"], name=risk,
>         )
>     )
>     
> fig.update_layout(barmode="stack", height=400, width=800, margin=dict(b=60, t=20, l=20, r=20))
> fig.show()

i get the following graph:

Screenshot 2020-06-26 at 9.56.17 AM

how do i remove these horizontal lines, i have tried using opacity but does not work. when i hover over the chart i have noticed that the opacity is related to the value for that row , e.g. the lighhter the colour the lower the value… however i do not want this i just want it as one block. so where you see the different shades of red i want that as just one shade.

What’s happening here is that you have many many small bars, and the outlines are creating this layered look. If you want aggregated bars, you can switch to using a Histogram trace, which will group them up into a single bar.

@nicolaskruchten i tried that but then it merges my predict and atual bar charts