0

I have a dataset

200 45000
600 260000
2000 680000
18000 2800000

I generated this by processing other data (set like {(x0, y0), (x1, y1),..}). On the first row in the first column is the low quartile of x and in the second column is sum of ys corresponding to data with x_0 < 200. In the second column it is similar but the first column is median and second column is the mentioned sum for 200 < x_0 <= 600. Third is similar (just with high quartile), fourth has the maximum value of x in the first column.

I want to render a box plot similar to the one below but the xtics should be right between the borders of the boxes (so each box would be between two xtics). How can I do that? The manual page for "set xtics" didn't help.

box plot

This was generated by this code (few unimportant style settings not shown):

plot 'data/example.dat' using 1:2:xtic(1) with boxes

There is a related question Gnuplot put xtics between bars but I don't think I can apply that since I want my boxes to keep their width (although I need to somehow modify it a bit so that 200 and 600 don't overlap).

Niklas
  • 13,005
  • 23
  • 79
  • 119
ondrejsl
  • 37
  • 6

1 Answers1

1

You can use the fsteps plotting style. But, with this you need to add an additional line to get the plot right:

0   45000
200 45000
600 260000
2000 680000
18000 2800000

and plot this e.g. with

set xtic rotate
plot 'test.dat' using 1:2:xtic(1) with fsteps lw 3 notitle

enter image description here

Christoph
  • 47,569
  • 8
  • 87
  • 187