You can simply just add updat_traces
method with desired colors and remove color_discrete_sequence
to get what you want:
import plotly.express as px
import pandas as pd
data_media_pH = pd.DataFrame([[8.33, 8.36, 8.36], [8.21, 8.18, 8.21], [7.50, 7.56, 7.64]], index=["4 °C", "37 °C", "37 °C + 5 % CO<sub>2"])
fig_media_pH = px.bar(data_media_pH, barmode="group")
# Adjust layout
fig_media_pH = fig_media_pH.update_layout(
showlegend=False,
xaxis_title_text=None,
yaxis_title_text="pH",
width=900,
height=800,
margin=dict(t=0, b=0, l=0, r=0),
yaxis_range=(6.5, 8.6)
)
# here:
fig_media_pH.update_traces(marker_color=["#0C3B5D", "#EF3A4C", "#FCB94D"])
fig_media_pH.show()