0

I am trying to plot some data using plotly graph_objects. X axis has dates as categories and Y axis has depth values. I realized my graph becomes less visible when there is a relevant quantity of data. It almost seems that it become transparent.

I already tried to change the opacity to 1 or bargroupgap to 0, but it is still weird. See image below:

enter image description here

# Create a figure
fig = go.Figure()

# Plot bars using go.Bar
fig.add_trace(go.Bar(
    x=well_df['DATE'],  # Intervals as x-axis
    y=well_df['y_end'] - well_df['y_start'],  # Height of the bars (difference between end and start)
    base=well_df['y_start'],  # Bottom of the bars (starting at y_start)
    marker=dict(color=well_df['FILTRO'].map(color_map), opacity=1),  # Map colors for categories
    opacity=1))

# Customize layout
fig.update_layout(
    xaxis_title="DATE",
    yaxis_title="DEPTH",
    yaxis=dict(autorange="reversed"),
    barmode='group',  # Group bars by category
    bargap=0.05, # Change this value to modiffy gaps between different categories 
    bargroupgap=0,
    xaxis=dict(tickangle=45),  # Rotate values from x axis to 45°
    showlegend=False)

# Show the plot
fig.show(renderer="browser")

How can I make it to look more visible (with stronger colors)?

1
  • What immediately comes to mind is the horizontal bar chart. Add orientation='h' to the settings. Commented Nov 14, 2024 at 23:51

1 Answer 1

0

I managed to solve it by updating line width:

fig.update_traces(marker_line_width=0)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.