[R] Help with barplot
Hello all, I need to create a horizontal barplot with the following data: City Median Springfield 34 Worcester 66 Fitchburg 65 Lowell 63 Quincy 62 Boston 36 Cambridge54 Waltham 42 Medford 52 Pittsfield 65 Rensselaer 60 Schenectady 56 Glens Falls 64 The code below produces the bars for the Median, but how or where do I specify the corresponding city name on the y-axis for the bars. x-data.frame(City=ozone.ne.trim$City,Median=ozone.ne.trim$Median) with (x, barplot(Median,horiz=TRUE)) Please help. Mathangi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Help with barplot
par(mar=par()$mar+c(0,3,0,0)) with(x, barplot(structure(Median, names=as.character(City)),horiz=T,las=2)) [EMAIL PROTECTED] a écrit : Hello all, I need to create a horizontal barplot with the following data: City Median Springfield 34 Worcester 66 Fitchburg 65 Lowell 63 Quincy 62 Boston 36 Cambridge54 Waltham 42 Medford 52 Pittsfield 65 Rensselaer 60 Schenectady 56 Glens Falls 64 The code below produces the bars for the Median, but how or where do I specify the corresponding city name on the y-axis for the bars. x-data.frame(City=ozone.ne.trim$City,Median=ozone.ne.trim$Median) with (x, barplot(Median,horiz=TRUE)) Please help. Mathangi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help on barplot
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.00 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.00e+00 7.5 0.00 0.00e+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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help on barplot
No practical difference in this case. Either way you end up with the matrix rotated 90 degrees. Presumably t(d) for a large d would be faster, however at 11:30 last night, using rbind() for some reason was the first approach that came to mind... ;-) Marc On Mon, 2003-07-21 at 08:30, Spencer Graves wrote: 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.00 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.00e+00 7.5 0.00 0.00e+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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] help on barplot
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.00 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.00e+00 7.5 0.00 0.00e+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 -- Murad Nayal M.D. Ph.D. Department of Biochemistry and Molecular Biophysics College of Physicians and Surgeons of Columbia University 630 West 168th Street. New York, NY 10032 Tel: 212-305-6884 Fax: 212-305-6926 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help on barplot
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.00 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.00e+00 7.5 0.00 0.00e+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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help