Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot: insert custom xtic label amidst otherwise regular tic intervals

Tags:

graph

gnuplot

I'm actually using orgmode to export, so my data is simply in org-table form; that shouldn't matter. It's like so:

|  Time | Video | Presentation | Paper |
|-------+-------+--------------+-------|
|     0 |     0 |            0 |     0 |
|    20 |    54 |           63 |    38 |
| 31.25 |    72 |           81 |    44 |
|   33. |    83 |           89 |    49 |
|   34. |    95 |          101 |    54 |
|  36.5 |   102 |          112 |    59 |

This is for work, and I'm plotting file downloads over the number of hours since they were made available. An effort was made to point people toward these files at t=28hrs, and I wanted to have a custom tick there matching a vertical line so I could call attention to that and show the downloads before and after the publicity effort. Thus, my gnuplot code looks like so:

set title "File Downloads"

set xlabel "Time Since Posting (hrs)"
set xrange [0:40]
set xtics  0,5,40

set ylabel "Downloads"
set yrange [0:125]
set ytics 0,25,125

plot data u 2:3 w l lw 2 lc 1 title 'Video', \
     data u 2:4 w l lw 2 lc 2 title 'Presentation', \
     data u 2:5 w l lw 2 lc 3 title 'Paper

I'm aware that one can do something like

set xtics ("0" 0, "10" 10, "Event" 30, "40" 40)

But I don't really want to do that for all my tics, especially since this will be an ongoing plot and I don't know how far in time I'll track things. Can I specify a regular set of intervals like the above, but then call out a custom tic on top of the axis somehow amidst those pre-defineid tics? This won't work, but for example:

set xtics 0,5,40; ("Event" 30)

Thanks for any suggestions.

like image 577
Hendy Avatar asked Nov 08 '11 22:11

Hendy


1 Answers

Shown with "Pi" in the documentation:

set xtics 0,5,40
set xtics add ("Event" 30)
like image 190
choroba Avatar answered Sep 22 '22 23:09

choroba