cjbrazel
cjbrazel

Reputation: 25

Splitting the range of an axis, to reduce white space

I would like to remove specific xtic values (hours axis) in my graph that are not being used with other data. To be precise, I want to keep the following Xranges [0:5, 12:14], but not the xrange [6:11]. This is to help space out my data, since the unused space is currently smashing them together. I will attach a picture to visualize. Thank you for any helpgraph example

I tried 'set xrange [0:5, 12:14]' but it did not work.

Upvotes: 0

Views: 196

Answers (1)

theozh
theozh

Reputation: 25714

It is important to know the exact structure of the data because the plotting code needs to adapt to it. For the following example the data structure is as follows:

  • 7 blocks separated by double blank lines with x y z data.
  • Each block has a constant x value (from the values 0 1 2 3 5 12 14) whereas y and z vary.
  • If you have double blank lines you can address the blocks via index (check help index).
  • The x values are not equidistant, but you basically want to make them appear equidistant. For this, you can use the pseudocolumn -2 (check help pseudocolumns) which contains the block number starting from 0.
  • The xtic label is used from column 1 (check help xticlabels).

Code:

### plot "non-equidistant" data equidistant
reset session

# create some test data
set print $Data
    do for [x in "0 1 2 3 5 12 14"] {
        do for [y=-40:40] {
            print sprintf("%s %g %g", x, y, (16-x)*cos(0.05*y)**2)
        }
        print "\n\n"
    }
set print

set xyplane at 0
set grid x,y
set view 60,140
set key at screen 0.3, screen 0.95 noautotitle
set xrange [-0.5:6.5]

splot for [i=0:6] $Data u -2:2:3:xtic(1) index i w l lc i
### end of code

Result:

enter image description here

Upvotes: 1

Related Questions