Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to reduce space between columns in a horizontal legend [Python]

I would like to reduce space between legend columns (An example is shown in the attached image).
So, what I want to do is,

[before]

(Sym.)A —— (Sym.)B —— (Sym.)C —— (Sym.)D

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

[after]

(Sym.)A — (Sym.)B — (Sym.)C — (Sym.)D

Is there a way to do it?
(e.g., plt.legend(ncol=4, [a hidden parameter??]))

Thanks!

![image here]

>Solution :

Take a look at the description of columnspacing from documentation. You can try:

plt.legend(ncol=4, columnspacing=0.8)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading