Note that there are some explanatory texts on larger screens.

plurals
  1. POPersonalize X axis values display on R using lattice
    primarykey
    data
    text
    <p>I have a huge collection of data with date, client and its NFS usage. I'm using lattice R package for plotting, <a href="https://superuser.com/questions/523195/plot-custom-log-data-on-gnu-linux/523217">as adviced on superuser</a>. Also, Stackoverflow helped me on <a href="https://stackoverflow.com/questions/14234197/x-scale-values-very-compacted-on-r-plots-with-lattice">converting the date string to an actual date object</a>.</p> <p>Now, my code is this:</p> <pre><code>require(lattice) logfile &lt;- read.table(file="nfsclients-2d.log") names(logfile) &lt;- c("Date","Client","Operations") allcol &lt;- c("blue","chocolate4","cornflowerblue","chartreuse4","brown3","darkorange3","darkorchid3","red","deeppink4","lightsalmon3","yellow","mistyrose4","seagreen3","green","violet","palegreen4","grey","slateblue3","tomato2","darkgoldenrod2","chartreuse","orange","black","yellowgreen","slategray3","navy","firebrick1","darkslategray3","bisque3","goldenrod4","antiquewhite2","coral","blue4","cyan4","darkred","orangered","purple4","royalblue4","salmon") col=allcol[0:length(levels(logfile$Client))] svg(filename="/tmp/nfsclients-2d.svg",width=14,height=7) times &lt;- as.POSIXct(strptime(levels(logfile$Date), format="%m/%d-%H:%M")) logfile$Date &lt;- times[logfile$Date] xyplot(Operations~Date,group=Client,data=logfile,jitter.x=T,jitter.y=T, aspect = 0.5, type = "l", par.settings=list(superpose.line=list(col=col,lwd=3)), xlab="Time", ylab="Operations", main="NFS Operations (last 2 days, only clients with &gt;40 operations/sec)", key=list( text=list(levels(logfile$Client)), space='right', lines=list(col=col),columns=1,lwd=3,cex=0.75)) dev.off() </code></pre> <p>And the output file is this (stripped out the legend):</p> <p><img src="https://i.stack.imgur.com/9Ps7s.png" alt="enter image description here"></p> <p>The X axis values are not very useful here: "tue" "tue" "wed" "wed". It seems that it only takes the first significative value as label. Some more labels (maybe 6 or 7) would be more useful also.</p> <p>When plotting 2 weeks it's even worse. Only 2 values are displayed on the X axis: "2012" "2013". Not even repeated, only 2 values!</p> <p>The <a href="http://pastebin.com/eWrBSsKd" rel="nofollow noreferrer">data I'm plotting</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload