Bar mekko with columns adjacent to each other

71 Views Asked by At

I have the following code for a bar mekko chart:

import plotly.graph_objects as go

# Sample data
categories = ['Category 1', 'Category 2', 'Category 3']
values = [40, 60, 30]

# Creating the bar Mekko chart
fig = go.Figure(go.Bar(
    x=categories,
    y=values,
    width=[0.3, 1.0, 0.2],  # Adjust widths as needed
    marker=dict(color=['lightblue', 'lightgreen', 'lightcoral'])
))

# Setting the layout
fig.update_layout(
    title='Bar Mekko Chart',
    xaxis_title='Categories',
    yaxis_title='Values'
)

# Displaying the chart
fig.show()

While I am successfully able to change column width, I would like to the columns adjacent to each other separated only by a thick white border.

0

There are 0 best solutions below