|
From: Steve C. <sc...@ja...> - 2009-12-01 22:33:07
|
CLOSE Dave wrote: > Steve Cohen wrote: > >> Having recently swum in these same shark-infested waters myself (I am >> not a developer of this project, just a user like you) I would first >> get rid of >> set xdata time >> set timefmt "%Y-%m" >> set format x "%m\\n%Y" >> >> Histograms and these time functions simply don't mix. At all. > > Thank you to both Steve and Hans-Bernhard for that. I wonder if this > would merit mention in the manual? > >> You will, of course, then, not see labels on your x-axis, but you >> should at least see a graph. >> >> Now, for those x-axis labels, Gnuplot's string functions are your >> friend: >> >> plot "/tmp/file" using >> 2:xtic(substr(stringcolumn(1),6,7)\\nsubstr(stringcolumn(1),1,4), >> "/tmp/file" using ($3+$4+$5+$6+$7) >> axis x1y2 > > Thank you, Steve. I was in the process of researching how to get the > labels I need when your note dramatically shortened my effort. But I did > need to change your suggestion slightly. > > 1. Your parentheses weren't balanced (easy to fix). > 2. \\n doesn't work in that place. I had to change it to '."\n".'. That > is, put it in quotes and use string concatenation. I could also have > used sprintf but that takes more characters to type. > 3. I had to add "bmargin 3" so the second line of label would actually > appear. > > Dave Close > > > ------------------------------------------------------------------------------ > Join us December 9, 2009 for the Red Hat Virtual Experience, > a free event focused on virtualization and cloud computing. > Attend in-depth sessions from your desk. Your couch. Anywhere. > http://p.sf.net/sfu/redhat-sfdev2dev > _______________________________________________ > Gnuplot-info mailing list > Gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > Heh, I'm a relative newbie myself and I thought my concatenation was weak, but I didn't see an explicit concat() function, but I decided to send it anyway and so you've gone me one better and taught me something. In my similar example I was able to take a substring of the date as a whole without needing to concatenate the pieces. If your source is a database query you might consider rewriting it if you can to avoid such ugliness. another trick for the x labels is set xtics nomirror out rotate by -45 which outputs the labels diagonally so you can squeeze more in. Don't know if that would work for you. Steve |