Ok. I spent yesterday afternoon figuring it out, and it's not a perfect
solution, but a workable one.
I am using gnuplot to plot charts of amperage/power data. The logger
generates a database entry (SQLite) every 60 seconds or so, so plotting a
monthly line chart is what I'm going for, but plotting xticlabels was very
messy, because it would place a label every minute for an entire month's
worth of data.
The basic solution was to generate a plot using precise timestamps and with
a yrange writeback
set timefmt "%m/%d/%Y %H:%M:%S"
set yrange [*:*] writeback
set output "unknown" - this is a fix for an issue I found with PNG output
plot sqlite command with select statement for all timestamps and data with
lines
then
set yrange restore
set terminal png size 950,480
set output "outfile.png"
replot sqlite command select distinct days that logging occurs with simply a
date as a timestamp and a zero value as column 2, 1:2:xtics(1)
Issues: this works for me because amperage is usually positive and the zero
values generated in the replot are ignored by using the yrange restore. If
I were using data that had negative values, this would be an issue, because
it would leave marks on the x Axis line.
I hope I've helped you and have given you some ideas for fixing your
problem.
Dick R.
2012_December_sensor2_amperage.png
<http://gnuplot.10905.n7.nabble.com/file/n17088/2012_December_sensor2_amperage.png>
sabretoothedhamster wrote
> Hello gnuplot gurus!
>
> Help me please with unexpected gnuplot (4.6/win32) behavior.
> I do have the data file which looks like this:
>
> ...
> 21:20:58.784;538633;752;543;520;541;1;70;543;521;541
> 21:20:58.799;538734;755;543;521;541;1;70;543;520;541
> 21:20:58.831;538835;754;542;520;541;1;70;543;520;541
> ....
>
> And I have got two issues while trying to plot it.
>
> 1st. If I plot with the following script:
> =============================================
> reset
> set datafile separator ';'
> set title "Test"
> set terminal windows size 1680,1050
> set y2tics border
> set yrange[440:640]
> set y2range[-150:150]
> set xtics border rotate by 90 autofreq offset 0,-2
> plot "data.csv" \
> every::1::25000 using ($0):4 title "V" with lines, \
> "" u ($0):6 t "Vzero" w l, \
> "" u ($0):9 t "Vmean" w l, \
> "" u ($0):10 t "TurnA" w l, \
> "" u ($0):5 t "BumpA" w l, \
> "" u ($0):7 axes x1y2 t "dV" w l
> =============================================
>
> everything looks fine. Gnuplot puts line numbers as xticlabels with proper
> interval (about 5000 with "autofreq" or any particular number given
> instead of autofreq).
> But if I try to show the time values (from the first column, by "using
> ($0):4:xticlabels(1)") instead of line numbers then gnuplot goes mad. It
> prints time (and draws gridline) for every single line of data no matter
> if I use 'autofreq' or specify precise step value.
> How can I force gnuplot to thin textual labels out?
>
> 2nd. The minor one. Having the script from the first issue I have got
> xticlabels (numbers) too close to the axis line. Bit if I try to put them
> away by changing "offset 0,-2" to e.g. "offset 0,-3" xticlabels completely
> disappear. I suppose they are not shown because their starting point
> appears out of some bounding box, but I can not figure out which one and
> how to extend it (preferably automatically, depending on the length of
> xticlabels).
>
> Thanks you in advance!
--
View this message in context: http://gnuplot.10905.n7.nabble.com/how-to-thin-out-textual-xticlabels-tp2093p17088.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|