How to break a key in gnuplot?

enter image description here

I built this table in gnuplot. as you can see that the key should be divided into two parts. The first 4 keys should remain in place, and the remaining 4 keys should move down so that they do not cross the data.

How can I split the key this way?

+6
source share
1 answer

One chart only supports one key, so it cannot be split. In addition, all data is built by one team, so you cannot build the first half of the data, change the key settings and display the other half.

There are other ways to put a key, for example. off site.

However, I have two workarounds:

Mannequins

First, you can add dummy sections:

plot \ sin(x), "+" u 1:(NaN) title " " w dots linecolor rgb "white", "+" u 1:(NaN) title " " w dots linecolor rgb "white", cos(x) title "cosinus", tan(x) title "tangens" 

Due to 1:(NaN) data is not plottet. The only point in the legend is white, and the title is a space. Thus, it looks like empty lines in a key:

enter image description here

Multiplot

Another solution is to create two charts using multipot:

 set xrange[...] set yrange[...] set multiplot plot sin(x) set key bottom right plot cos(x) linetype 2 unset multiplot 

Please note that here you must explicitly set ranges. In addition, axes, ticks and marks are pulled twice, which may seem strange in some output formats. In this case, you can disable all of them before the second schedule, so that everything will be drawn only once.

Although this method is a bit more complicated, you have much more control over your key:

enter image description here

+8
source

Source: https://habr.com/ru/post/977947/


All Articles