David Collins
David Collins

Reputation: 900

What is the name of this type of graph?

I want to reproduce this graph in Python, but I don't know what the name of this graph is. Some keys features of this discrete graph are:

I did a reverse image google search, but to no available. Other similar questions here ask for names of other objects/features/graphs but not this particular graph.

If there is a named graph in Python, then I want to use it. If there is not, then I will create it and give it the common/well-known??? name.

The key feature that I find attractive in this graph is

enter image description here

For your curiosity, the data is carbon emissions produced by participants while they travel to/from a science conference in California, US, and is found in the supplementary materials of a recent article published in Nature 583, 356–359 (2020)

Upvotes: 0

Views: 124

Answers (1)

Akshay Sehgal
Akshay Sehgal

Reputation: 19307

This is called a waterfall chart. The X-axis has variable bin sizes for indexes but their labels have been modified to only show the start of a bin as if its a continuous axis. You can use the width of each bar equal to the size of the bin on x axis. This will give you the rectangles you are looking for. I also see few line plots at specific x and y values for marking interesting parts of the graph at 26%, 61% etc.

enter image description here

You can use plotly to work on charts like these. Code for a sample chart -

import plotly.graph_objects as go

fig = go.Figure(go.Waterfall(
    name = "20", orientation = "v",
    measure = ["relative", "relative", "total", "relative", "relative", "total"],
    x = ["Sales", "Consulting", "Net revenue", "Purchases", "Other expenses", "Profit before tax"],
    textposition = "outside",
    text = ["+60", "+80", "", "-40", "-20", "Total"],
    y = [60, 80, 0, -40, -20, 0],
    connector = {"line":{"color":"rgb(63, 63, 63)"}},
))

fig.update_layout(
        title = "Profit and loss statement 2018",
        showlegend = True
)

fig.show()

For visualizations like these, I would not really recommend python in the first place. Something like this is super easy to make in excel though.

Upvotes: 1

Related Questions