Bernhard
Bernhard

Reputation: 3694

Horizontal key with inverted ordering

When displaying the key using gnuplot 4.6, one can invert the ordering of the items in the key using set key invert

See, e.g.

set key invert
plot x, -x

The label for -x will be the top one.

Now, if use a horizontal key, e.g.

set key horizontal invert
plot x, -x

The key for x will be the leftmost legend, despite invert being set or not.

How can I invert the ordering of the keys in a horizontal legend?

Note: I know I can invert the ordering in the plot command, but that is not the solution I am looking for.

Upvotes: 2

Views: 1335

Answers (1)

Christoph
Christoph

Reputation: 48390

This combination of horizontal and invert is not supported, you may want to submit a feature request to add this.

Depending on your real use case, you could misuse the width option:

set key horizontal width -19

You may need to adapt the width settings depending on the font and terminal. And for very different title lenghts this does not look good.

As an example consider the script

reset
set terminal pngcairo size 800,500
set output 'keyinvert.png'
set multiplot layout 1,2
set key invert
plot x, -x, x**2

set key horizontal noinvert width -19
replot
unset multiplot

which gives the result: enter image description here

Upvotes: 3

Related Questions