Hello again, Please consider my data-frame: My_DF <- data.frame(Names = as.character(1:2000), Values = 1:2000) Now I want to create a Horizontal bar plot for this data: barplot(My_DF$Values, main="Bar Plot", horiz=TRUE, names.arg=My_DF$Names) You see the entire plot is messed-up. As I have to work with such lengthy data, is there any possibility with R on how I can plot the entire data-set clearly? Thanks and regards, [[alternative HTML version deleted]]
If you insist on bars instead of points, then have a look at the type ="h" argument to plot.default(). In general, designing an effective plot typically depends both on the nature of the subject matter, the data, and the intended audience, so it is difficult (for me, anyway) to give a useful generic answer. Cheers, Bert On Mon, Aug 5, 2013 at 1:11 PM, Christofer Bogaso <bogaso.christofer at gmail.com> wrote:> Hello again, > > Please consider my data-frame: > > My_DF <- data.frame(Names = as.character(1:2000), Values = 1:2000) > > Now I want to create a Horizontal bar plot for this data: > > barplot(My_DF$Values, main="Bar Plot", horiz=TRUE, names.arg=My_DF$Names) > > You see the entire plot is messed-up. As I have to work with such lengthy > data, is there any possibility with R on how I can plot the entire data-set > clearly? > > Thanks and regards, > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
It doesn't seem "messed up." You can't expect to plot two thousand bars on a graph and really see anything. On my monitor, there are only about 680 vertical pixels on the plot window, you are trying to plot 3 bars for each row of dots on the monitor! Try this (just the first twenty lines of your data): barplot(My_DF$Values[1:20], main="Bar Plot", horiz=TRUE, names.arg=My_DF$Names[1:20], cex.names=.75, las=1) Now imagine what happens when you try to squeeze 100 bars inside each of those bars. Impossible and a waste of ink. You surely want some other way to present the data. ------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Christofer Bogaso Sent: Monday, August 5, 2013 3:11 PM To: r-help Subject: [R] Horizontal bar plot for lengthy data Hello again, Please consider my data-frame: My_DF <- data.frame(Names = as.character(1:2000), Values = 1:2000) Now I want to create a Horizontal bar plot for this data: barplot(My_DF$Values, main="Bar Plot", horiz=TRUE, names.arg=My_DF$Names) You see the entire plot is messed-up. As I have to work with such lengthy data, is there any possibility with R on how I can plot the entire data-set clearly? Thanks and regards, [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.