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

Time:06-07

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


[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 of the current output:

enter image description here

CodePudding user response:

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

plt.legend(ncol=4, columnspacing=0.8)
  • Related