You have a couple of options to accomplish that kind of plot. I will use these sample data:
0 0
1 0.5
2 0.6
3 1
4 1.5
5 0.5
6 2.5
7 5
8 2
Multiplot method
Here you just make two plots of the same data on top of each other. Note that where the data cross the border of the plots there is a joint in the line (if you plot a line).
This is a little more complicated than the mapping method below.
#!/usr/bin/env gnuplot
reset
set terminal pdfcairo enhanced color lw 3 size 3,2 font 'Arial,14'
set output 'output.pdf'
set style data linespoints
set title 'my plot'
set key top left
set multiplot layout 2,1
### first (top) plot
# play with margins to ensure top and bottom plots are same size
set bmargin 0
set tmargin 2.5
# also that left margin is same with/without y label
set lmargin 6
set yrange [1:5]
unset xtics
set ytics 1 out scale 0.5 nomirror
# remove bottom line of border
set border 14
plot 'data.dat' pt 7 title 'my data'
### second (bottom) plot
unset title
# set margins to match first plot
set bmargin 2.5
set tmargin 0
set yrange [0:1]
# this offset along with the label offset compresses the bottom whitespace
set xtics out scale 0.5 nomirror offset 0,0.4
# create and place labels where they will be visible
set xlabel 'x label' offset 0,0.8
set ylabel 'y label' offset 1,3
# remove top line of border
set border 11
plot 'data.dat' pt 7 notitle
unset multiplot
reset
Result:
Mapping method
Here we create a mapping function and manipulate the y labels to match. Note there is no joint in the line, which may or may not be what you want.
#!/usr/bin/env gnuplot
reset
set terminal pdfcairo enhanced color lw 3 size 3,2 font 'Arial,14'
set output 'output2.pdf'
set style data linespoints
set key top left
set title 'my plot'
set xlabel 'x label'
set ylabel 'y label'
# mapping function
map(x) = x <= 1.0 ? x : (x-1.0)/4.0 + 1.0
# upper y bound is set by (5-1.0)/4.0 + 1.0
set yrange [0:2]
# y labels create illusion
set ytics out scale 0.5 nomirror \
("0" 0, "1" 1, "2" 1.25, "3" 1.5, "4" 1.75, "5" 2)
set xtics out scale 0.5 nomirror
plot 'data.dat' u 1:(map($2)) pt 7 title 'my data'
reset
Result:
set link
, which is available since 4.7, but my first tries didn't succeed:i(x) = x <= 1 ? x : 1 + (x-1)*4; f(x) = x <= 1 ? x : (x-1)/4.0 + 1; set link y2 via f(y) inverse i(y)
. – Spermset link y2 via y**2 inverse sqrt(y)
andplot x axis x1y2
or if i directly useplot sqrt(x)
. In both cases the y axis scale displays the wrong data – Loreenlorelei