Christian Langkamp
2009-Feb-16 19:08 UTC
[R] Adjusting the Axis in a histogram to the prespecified breaks
Hello I tried a few searches on hist, histogram, equidist and space (space=0 was mentioned in one contribution), but none of that so far worked. It also says in the help "##-- For non-equidistant breaks, counts should NOT be graphed unscaled:" - which is precisely what I am looking for, but I cannot find it. I want to make a histogram using breaks which are spaced exponentially and in reference to the largest item in the dataset (e.g. 0,1,2,4,8,16 if the largest one is 14). I want to make a histogram where the units on the axes have the same spacing as the breaks used for the histogram. I could of course log the whole data set, but then explaining that transformation within a presentation is generally not a pleasant exercise. On the other hand I would like to keep the code short and thus would like to avoid issues like factorisation. Something like x<- breaks .... hist(data, breaks= x, "xaxisbreaks=x") At the moment the axis is equalspaced by units (2,4,6,8) with 0-2 having 2 areas and the blocks 4-6 and 6-8 only having one block. I tried also the xlog entry (i.e. log="x") which returned "log" is not valid (ist kein Grafikparameter). I tried also fixing things with the par utility (>par(log=TRUE)) which again did not work. Hence if somebody has a recommendation (possibly a link to an older contribution which I did not find using the above searches), that would be great. -- View this message in context: http://www.nabble.com/Adjusting-the-Axis-in-a-histogram-to-the-prespecified-breaks-tp22043635p22043635.html Sent from the R help mailing list archive at Nabble.com.
Titus von der Malsburg
2009-Feb-16 19:21 UTC
[R] Adjusting the Axis in a histogram to the prespecified breaks
On Mon, Feb 16, 2009 at 11:08:24AM -0800, Christian Langkamp wrote:> I could of course log the whole data > set, but then explaining that transformation within a presentation is > generally not a pleasant exercise.You don't have to explain it. Just calculate the hist of the log and label the axis with 0, 1, 2, 4, 8, 16 See ?axis Titus