[R] Horizontal bar plot for lengthy data

David Carlson dcarlson at tamu.edu
Mon Aug 5 22:53:13 CEST 2013


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.



More information about the R-help mailing list