« Return to Thread: gnuplot tics

Re: gnuplot tics

by Thomas Sefzick :: Rate this Message:

| View in Thread

'help plot using xtic' says:
   xticlabels(N) is shorthand for xticlabels(stringcolumn(N))
so you may use
   plot 'data2.dat' using 3:xtic(stringcolumn(1)." ".stringcolumn(2)) t col

to have the ytics start at '0' you need to set yrange, not ytics:
   set yrange [0:*]

column 3 has no header, you need to tell gnuplot to use
the header of column '2' instead:
   plot 'data2.dat' using 3:xtic(stringcolumn(1)." ".stringcolumn(2)) t columnheader(2)

rihii wrote:
Hey, i have another problem :)

i have this code:
void plotBox(FILE *pipe){

        fprintf(pipe, "set grid\n"); // show grid
        fprintf(pipe, "set boxwidth 0.9 relative\n");
        fprintf(pipe, "set style fill   solid 1.00 border lt -1\n");
        fprintf(pipe, "set key outside right top vertical\n"); // show legend
        fprintf(pipe, "set style data histograms\n"); // plot data in histograms
        fprintf(pipe, "set style histogram clustered\n");
        fprintf(pipe, "set datafile missing '-'\n");
        fprintf(pipe, "set xtics border in scale 0,0 nomirror rotate by -45 autojustify\n");
        fprintf(pipe, "set xtics  norangelimit font ',13'\n");
        fprintf(pipe, "set xtics ()\n");
        fprintf(pipe, "set ytics 0, 1\n"); // set y starting point and step
        fprintf(pipe, "set ylabel 'Used current'\n"); // set y starting point and step
        fprintf(pipe, "set xlabel 'time'\n"); // set y starting point and step
        fprintf(pipe, "set title 'Current sense data'\n"); // title of graph
        fprintf(pipe, "plot 'data2.dat' using 3:xtic(2) t col\n"); // plot data
}
and data2.dat looks like this:
name Current
2012.06.13 12:41:04,52 24
2012.06.13 12:41:04,6 24
2012.06.13 12:41:04,72 24
2012.06.13 12:41:04,81 24
2012.06.13 12:41:04,91 24
2012.06.13 12:41:05,0 24
2012.06.13 12:41:05,12 24
2012.06.13 12:41:05,21 24
2012.06.13 12:41:05,31 24
2012.06.13 12:41:05,4 24
2012.06.13 12:41:05,52 24
2012.06.13 12:41:05,61 23
2012.06.13 12:41:05,71 24
2012.06.13 12:41:05,8 24
2012.06.14 12:41:05,61 23
2012.06.14 12:41:05,71 24
2012.06.14 12:41:05,8 24

and the plot looks like this:

55.png

soo, i would like to get the date into the xtics, so it would look like this: 2012.06.14 12:41:05,8

i tried fprintf(pipe, "plot 'data2.dat' using 3:xtic(1, 2) t col\n"); but it didnt work

also why ytics are starting from 23 and going to 24 if i hade specified fprintf(pipe, "set ytics 0, 1\n");

and lastly i had the first row: Name Current as the name of red stick, but now its 24. also dont know why.
Can you please help me? :)

 « Return to Thread: gnuplot tics