Hi, I have a problem with plotting my data as a histogram using barplot2. I am plotting the x axis using axis(). I want to label only every fifth bar and not all of them as they get too busy but I don't know how to do it. I was trying to set the labels for the axis using at=seq(min value, max value, by=5) but that leads to labels not being under the right bars but just sort of spread around. Does anyone know how to do it properly? Thanks in advance, Barbara -- View this message in context: http://r.789695.n4.nabble.com/x-axis-labels-tp4651589.html Sent from the R help mailing list archive at Nabble.com.
x axis labels
2 messages · apprentice, Jim Lemon
On 12/02/2012 09:49 AM, apprentice wrote:
Hi, I have a problem with plotting my data as a histogram using barplot2. I am plotting the x axis using axis(). I want to label only every fifth bar and not all of them as they get too busy but I don't know how to do it. I was trying to set the labels for the axis using at=seq(min value, max value, by=5) but that leads to labels not being under the right bars but just sort of spread around. Does anyone know how to do it properly?
Hi Barbara, Two ways I can think of. Get the bar positions from the call to barplot2: barpos<-barplot2(...) Try barp in the plotrix package. By default the bars or groups are spaced at integer values and you get the bar positions returned as well. Jim