How to plot like this ?

I found an image from statista. I’d like to plot like that in matlab is it possible ?

3 Comments

It's possible, just not easy or practical, and I wouldn't advise trying it. The connected box chart lines is not a standard style in MATLAB, and a quick search suggests it isn't one in most other language's plotting engines either.
Is the image you posted auto-generated from Statista? It looks like they may have started with a bar chart, exported it, and added the text and connecting lines in Adobe Illustrator. That's a workflow you can certainly do with MATLAB (and Adobe). I'd suggest saving the bar chart as SVG, PDF, or EPS to make it easier to work with in the graphics program.
In Matlab, that plot can be reproduced by a bar plot plus 4 patch objects. You'll need to know the properties of bar objects to understand how the bar width and interval can be grabbed. From there, it's just figuring out how to use those values to compute the patch perimeters.
Alternatively, the entire plot could be produced with patch objects alone. I haven't thought about which approach would be easiest.
Thanks for valuable comments 😊

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!