iiasa / message_ix

The integrated assessment and energy systems model MESSAGEix
https://docs.messageix.org
Apache License 2.0
119 stars 153 forks source link

Bars in stacked bar plots in tutorials are too wide #457

Closed OFR-IIASA closed 3 years ago

OFR-IIASA commented 3 years ago

The issue refers to the plots of the various tutorials - e.g. westeros_baseline.ipynb

Problem description

image

Versions

ixmp:        3.2.1.dev80+g40fc589
     40fc589 (HEAD -> master, origin/master, origin/HEAD) Merge branch 'master' of https://github.com/iiasa/ixmp
message_ix:  3.2.1.dev62+g4cde6cc
     ed74a6f (HEAD -> tutorial_update_addon2, origin/tutorial_update_addon2) black test_tutorials.py
message_data: installed
     3bfb76b (HEAD -> RES_add_5_year_timesteps2, origin/RES_add_5_year_timesteps2) added configuration files for ENGAGE submission 20210331 (ENGAGE 4.1.7)

click:       7.1.2
dask:        2020.12.0
graphviz:    0.13.2
jpype:       1.2.1
… JVM path:  C:\Program Files\Java\jre1.8.0_231\bin\server\jvm.dll
openpyxl:    3.0.5
pandas:      1.1.3
pint:        0.11
xarray:      0.15.1
yaml:        5.3.1

iam_units:   installed
jupyter:     installed
matplotlib:  3.3.2
plotnine:    0.7.0
pyam:        0.7.0+4.gc1ed1f8
     c1ed1f8 (HEAD -> master, origin/master, origin/HEAD) Add a tutorial how to read data from GAMS gdx to pyam (#424)

GAMS:        33.1.0

python:      3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)]
python-bits: 64
OS:          Windows
OS-release:  10
machine:     AMD64
processor:   Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
byteorder:   little
LC_ALL:      None
LANG:        None
LOCALE:      None.None
francescolovat commented 3 years ago

Hi @OFR-IIASA ,

I also noticed that issue when testing the release 3.2.0. See this comment.

From @khaeru's comment, it seems that the value set for the width in this line is too big.

khaeru commented 3 years ago

@francescolovat thanks for triaging here. Please keep in mind that links into non-public Slack conversations won't be clickable for others visiting the issue; so in the future, better to copy the text/description into your GitHub comment.

As you said, I think the culprit is this line in the simplified plots used in the tutorials: https://github.com/iiasa/message_ix/blob/93b65e5f7d8f2b96224179a82e2b1f3d95f11540/message_ix/reporting/computations.py#L96-L106

In Slack, I wrote:

I was looking at the plots for the Austria tutorials, and increased the width of those stacked bars so that those looked reasonable. But it seems like the width is too much for the Westeros examples.

So whoever fixes this should check both sets of tutorials to ensure the output looks reasonable.