Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using gnuplot, how to 'cut out' usused y-axis regions of the graph

Tags:

gnuplot

I am trying to plot a graph, where on the Y axis I have CPU Utilization, and the current range is from 0-100%. My data only consists from 0-20% and 80-100%, and I just have a large white gap from 20-80%. Is there any way to 'cut out' this blank space, so the viewer can see in more detail what is going on in the 0-20% and 80-100% ranges?

Thank you.

like image 850
Jereme Lamps Avatar asked Feb 22 '15 02:02

Jereme Lamps


People also ask

How to change the range of X and Y axes in gnuplot?

Now explore setting the ranges on the X and Y axes manually. By default gnuplot will automatically scale the axes to include all the data points, but this can be overridden if desired. Try zooming the plot out: set xrange [-2:12] set yrange [-1.2:1.2] replot and zooming into a portion: set xrange [2:5] set yrange [-0.75:0.75] replot

How to plot two curves on one axis in gnuplot?

same numerical Y axis, one curve can be compressed relative to the other, as gnuplot will scale the one axis to include both curves. To produce a more readable plot, You may refer each of the two curves to different Y axes with the defintitions: set ylabel 'Displacement (centimeters)'

How do I add residuals to a gnuplot plot?

The set y2tics bordercommand tells gnuplot to display this scale on the border of the plot. Without it, the new scale would be set, but it would not be shown on the right-hand side of the plot. Now it's time to add our residuals. We add them to the plot command, and specify that they should use the new y scale.

How to plot functions in gnuplot?

Plotting functions in gnuplot is really quite easy. Suppose you want to plot the function f(x) = exp(-x^2 / 2). In gnuplot, exponentiation uses **, not ^. So, after starting up gnuplot, at the gnuplot>prompt you would type:


1 Answers

As Christoph said in the comments this needs to be done manually using set multiplot and removing borders, etc. An example:

set multiplot
# remove border and ytics from right hand side
set border 7
set ytics nomirror
# set top and bottom margins for both halves of the plot
set tmargin at screen 0.96
set bmargin at screen 0.1
# set left and right margins for left half of the plot
set lmargin at screen 0.1
set rmargin at screen 0.5
# set xrange for left half of the plot
set xrange [0:2*pi]
# set some lines to delimit transition from one half of the plot to next
set arrow from screen 0.50,0.08 to screen 0.52,0.12 nohead
set arrow from screen 0.49,0.08 to screen 0.51,0.12 nohead
set arrow from screen 0.50,0.94 to screen 0.52,0.98 nohead
set arrow from screen 0.49,0.94 to screen 0.51,0.98 nohead
# plot left half
plot sin(x) not
# remove border from left hand side and set ytics on the right
set border 13
unset ytics
set y2tics
set format y2 ""
# set left and right margins for right half of the plot
set lmargin at screen 0.51
set rmargin at screen 0.91
# set xrange for right half of the plot
set xrange [13.5:13.5+2*pi]
# plot
plot sin(x) axes x1y2

enter image description here

like image 95
Miguel Avatar answered Oct 10 '22 03:10

Miguel