Only 1 y tag in GNUplot multiset

I am using gnu graph to draw a multiplexer, and in my script I set the y label as follows:

set ylabel "foobar" 

Now each graph in the multiset has a highlighted y mark on their y axis. However, I would like to have only one y mark for all the graphs in the multiplex and center, which also indicate the common y axis. How can i do this? I am using 7.1 animation layout. Thus, all graphs have the same y axis.

+8
source share
4 answers

The easiest way is to make the first graph, then turn off the y label:

 set ylabel 'foo' set multiplot plot 'data1.dat' unset ylabel plot 'data2.dat' plot ... unset multiplot 

This will make the x-dimension of the first graph different from the size of all other graphs, so you may need to play with the margins if you want all the graphs to be the same size.

+6
source

Separate individual panels of the reduced size without labels, but with a frame, ticks and a title, then define a full-size panel with labels, but without borders, ticks and headers. You may need to draw a dummy function (1/0).

+3
source

Global Label Workaround

This is not ideal, but if you are desperate like me, you can use the rotated global shortcut + large left margins:

 #!/usr/bin/env gnuplot label_label_size = 14 set terminal png set output "gnuplot.png" set multiplot layout 2,1 title "Multiplot with one ylabel" font ",18" set lmargin 10 set label "My y-label" at screen 0.05,0.5 center front rotate \ font "," . label_label_size plot sin(x) set xlabel 'My x-label' font "," . label_label_size plot cos(x) 

enter image description here

Here's a realistic application that prompted me to do this: Heap vs Binary Search Tree (BST)

Tested in gnuplot 5.2 patchlevel 6, Ubuntu 19.04.

0
source

This is basically a sentence from the answer of Fabian Clermont, but (for beginners) is entered into the code and visualized. In fact, the Ciro Santilli solution is even shorter.

Tested with gnuplot 5.2. For gnuplot 4.6 (OP question time) replace reset session reset and set margin 8,-1,1-1 with set lmargin 8 and set bmargin 1 .

Code:

 ### Multiplot with single y-label reset session unset key set sample 500 set multiplot layout 7,1 unset ylabel set linetype 1 lc rgb "red" set margins 8,-1,1,-1 # left, right, bottom, top (-1=auto) set ytic 1.0 set title "Plot 1" offset 0,-1 plot sin(1*x) set title "Plot 2" offset 0,-1 plot sin(2*x) set title "Plot 3" offset 0,-1 plot sin(3*x) set title "Plot 4" offset 0,-1 plot sin(4*x) set title "Plot 5" offset 0,-1 plot sin(5*x) set title "Plot 6" offset 0,-1 plot sin(6*x) set title "Plot 7" offset 0,-1 plot sin(7*x) set lmargin -1 # automatic lmargin unset title set origin 0,0 set size 1,1 set border 0 unset tics set ylabel "This is a centered y-label" plot [][0:1] -1 # plot a dummy line out of range unset multiplot ### end of code 

Result:

enter image description here

0
source

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


All Articles