[R] help on barplot
Spencer Graves
spencer.graves at pdf.com
Mon Jul 21 15:30:36 CEST 2003
Please relieve me my ignorance on one point: How does "rbind(d[, 1],
d[, 2])" differe from "t(d)"?
Thanks, Spencer Graves
Marc Schwartz wrote:
> On Sun, 2003-07-20 at 21:16, Murad Nayal wrote:
>
>>Hello,
>>
>>I am trying to compare two histograms using barplot. the idea is to plot
>>the histograms as pairs of columns side by side for each x value. I was
>>able to do it using barplot before but I can't remember now for the life
>>of me now how I did it in the past:
>>
>>
>>>d
>>
>> [,1] [,2]
>>-37.5 0.0000000000 2.789396e-05
>>-32.5 0.0001394700 5.578801e-05
>>-27.5 0.0019804742 1.732218e-02
>>-22.5 0.0217294282 1.380474e-01
>>-17.5 0.0938912134 4.005579e-02
>>-12.5 0.0630683403 4.351464e-03
>>-7.5 0.0163179916 8.368201e-05
>>-2.5 0.0025941423 5.578801e-05
>>2.5 0.0002789400 0.000000e+00
>>7.5 0.0000000000 0.000000e+00
>>
>>
>>>barplot(d,beside=TRUE)
>>
>>barplot here plots two separate 'sets' of columns, on the left side a
>>bar plot of d[,1] is plotted while on the right side a separate bar plot
>>of d[,2] is plotted. how can I combine the two?
>>
>>actually, while on the subject of histograms. is it possible to plot a
>>3D-histogram in R (a true 3D bar plot, without using image).
>>
>>many thanks
>>Murad
>
>
>
> You need to restructure the data passed to barplot() so that the two
> 'height' related columns are converted to 2 rows of 10 columns. Each
> column is then drawn as pairs of bars:
>
> barplot(rbind(d[, 1], d[, 2]), beside = TRUE)
>
> Take a look at the change in structure as a result of:
>
> rbind(d[, 1], d[, 2])
>
> In terms of 3d histograms, it would appear that Duncan Murdoch, Daniel
> Adler et al are working on porting Duncan's Windows only DJMRGL package
> (http://www.stats.uwo.ca/faculty/murdoch/software) to multiple platforms
> at (http://wsopuppenkiste.wiso.uni-goettingen.de/~dadler/rgl). If my
> read is correct, it looks like they have some of the primitives ready to
> go at this time, but perhaps have not yet converted Duncan's hist3d()
> function.
>
> HTH,
>
> Marc Schwartz
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list