Displaying 20 results from an estimated 10000 matches similar to: "Reverse legend label order in barplot"
2008 May 03
2
Stacked bar plot anomaly When column contains a negative and a positive value
Hello users,
I've noticed a problem when creating a stacked column plot when a column
contains a negative and a positive value. e.g.
series1<-c(-1,-2, 3, 4, 5)
series2<-c( 5, -4,-3,-2, 1)
data<-rbind(series1,series2)
barplot(as.matrix(data), beside=FALSE)
In these cases (i.e. first, third and fifth columns) the plotting is not
handled correctly. Compare this output with that
2009 Apr 08
0
Customize Legend in Juxtaposed Barplot
Hello, I'm making barplots out of binary data, typically 0=no 1=yes,
but in some instances I have 2=Don't Know.
Anyway, when I create a juxtaposed barplot, what appears in the legend
is 0,1,and 2.
I want it to read No, Yes, Don't Know.
I'm not sure how to do that.
In addition to this, the other variable that this juxtaposed barplot is
grouped by is grade level, which is a
2005 Feb 18
3
Barplot - Can't figure it out
Hi,
I have two catagorical vectors like this;
x = c(1, 2, 4, 2, 1)
y = c(2, 4, 2 ,4, 1)
I want to set up a barplot with the catagories 1-4 horizontally and
number of occurances vertically for each vector x,y. I've tried
boxplot(table(x,y), beside=T)
and
boxplot(c(x,y), beside=T)
among others, but can't get it to work...Any ideas? I'd apppreciate any help
2004 Dec 10
1
bar charts
Hi,
I'd like plot a bar graphic of a array.
I'd like to have the values of the single columns as juxtaposed bars (like in
"barplot" with beside=TRUE) and I'd like to have the values of the single
columns expressed like percentage of the sum of the coloumn.
In this way all the bars are composed by the sum of the percentage of the
values of a coloumn (with different colors)
2005 Apr 18
3
Barplot and colors for legend
Hi all!
One quick question: How do I get the standard colors
used by barplot? I have
some stacked bars and would like to add a horizontal
legend via legend() but I
don't know how to find the colors for the fills of the
legend points.
Thanks!
Werner
2004 Dec 01
2
barplot() using beside=TRUE and the density argument
Hi
I am using barplot() to draw some barplots, with a matrix as the data so
that multiple bars are drawn for each data point. I want to use the
argument "beside=TRUE" to juxtapose the bars instead of stacking them.
If I execute:
barplot(data,names.arg=names,density=c(20,10),beside=FALSE)
I get the expected behaviour i.e. the bottom part of the column is
shaded 20 lines per inch, the
2004 Apr 19
1
barplot fill patterns
Dear R-helpers,
I will like to know if there is a way to generate a stacked column
graph using both patterns and colors to fill the bars. I have many
categories for the number of color available in R, so I will like R to
start with solid colors and then use patterns an colors. I have been
using barplot and some code that I found in the archives, but I am
still having bars with the
2010 Jun 11
2
Transforming simulation data which is spread across many files into a barplot
I'm an R newbie, and I'm just trying to use some of it's graphing
capabilities, but I'm a bit stuck - basically in massaging the already
available data into a format R likes.
I have a simulation environment which produces logs, which represent a
number of different things. I then run a python script on this data, and
putting it in a nicer format. Essentially, the python script
2009 Mar 03
2
preparing data for barplot()
What is the best way to produce a barplot from my data? I would like
the barplot to show each person with the values stacked
val1+val2+val3, so there is one bar for each person When I use
barplot(data.matrix(realdata)), it shows one bar for each value
instead.
To post here, I created an artificical data set, but it works fine.
fakedata <- as.data.frame(list(LETTERS[1:3]))
colnames(fakedata)
2007 May 15
1
stacked barplot with positive and negatvie values
Hello I'm trying to create a barplot with a couple of stacked positive
values and with one negative value for each group.
example:
trees<-c(20,30,10)
shrubs<-c(12,23,9)
veg<-c(2,3,4)
soil<-c(-100,-123,-89)
example1<-t(cbind(trees,shrubs,veg))
barplot(example1)
#this works so far
#but now:
example2<-t(cbind(trees,shrubs,veg,soil))
barplot(example2)
This shows no more
2012 Jan 10
2
stacked barplot colour coding
Hi all,
i'm fairly new to R and its graphing, but having unsuccessfully 'googled'
and checked this forum to find answer to my problem, i'm posting my question
here.
I'm trying to plot stacked barplot. I have simple data that looks like this:
bg ag
0.41 2.81
0.37 2.91
0.31 2.06
0.32 2.39
every row indicates a factor (1,2,3,4, see below in names.arg). Now when i
plot
2006 Oct 13
3
Barplot legend position
Dear useRs,
I'm trying to create a barplot like so:
x=matrix(1:10,2,5)
barplot(x,leg=c("left","right"),besid=T)
The legend is placed in default position topright, however the data are
plotted there too. I tried controlling the legend position by adding
x="topleft" but this results in an error that x matches multiple formal
arguments.
Leaving out the legend
2009 Jan 20
2
Stacked barplot with two stacked bars besides each other
Hi,
I have a particular barplot I would like to generate, but I am having
trouble getting it to work. What I would like is in effect two barplots
with stacked bars merged into one. For example, I have two samples
(yoda1,yoda2) on which I measure whether two variables (var1,var2) are
present or absent for a number of measurements on that sample.
> var1 <- data.frame(yoda1=c(3,7),
2003 Mar 21
1
barplot legend size
Dear R-people,
are there any way to change the size of legend in barplot? I have
tried various versions of cex, both as par(cex.*= ) and barplot(...,
cex.*= ). So long without success.
Sincerely,
Ott
> version
_
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 1
2002 Nov 12
4
trouble positioning legends on barplot written to a file
I'm trying to generate some plots for print publication and I'm having trouble
getting them the way I want. I get a plot with a legend that overlaps the bars
and looks bad. Also, I'm saving this as PDF file (whatever happened to the
"png" function to save as PNG format, in r 1.4.1?)
I've tried a number of things, which produce a number of questions.
1) it seems that the
2023 May 02
1
Error in percentage stacked barplot
Dear all,?
I am trying to plot the following table in stacked barplot in percentages and also horizontal.
Component? ? ? Sample 1? ? ? Sample 2? ? ? Sample 3CaO????????????????? ? 45????????????? ? 52????????????? ? 48SiO2????????????????? ?25????????????? ? 22????????????? ? 18Al2O3?????????????????15????????????? ? 11????????????? ? 14TiO2? ? ? ? ? ? ? ? ? ? ?6? ? ? ? ? ? ? ? ? 5? ? ? ? ? ? ? ?
2002 Jan 08
1
dimensions of stacked barplot
I'm plotting stacked barplots using:
> barplot(tmp, beside=F)
This gives me several stacked bars. Each stack is divided into several
segments. I'd like to add a dotted line from the edge of one segment to
the same edge on the next stacked bar. This might help to see which
stack shrinks or expands from one stacked bar to the next.
I'm thinking that I could overlay dotted lines
2012 Nov 12
2
order in stacked barplot
Hello
i did a stacked barplot using ggplot and R arranged the bars of the items in
different orders. i don?t know why. but i want to have the same order in
every stacked bar.
I used the code
data1 <- read.table("N_O_W_MAI.txt", header=TRUE, dec = ",")
attach(data1)
Teich1<-factor(Teich,levels=c(5,7,9,11,"G") ,ordered=is.ordered(Teich))
2007 Mar 02
1
barplot with different color combination for each bar
Hi,
I'd like to construct a somewhat unusual barplot. In "barplot" I use
beside=F as I'd like to have stacked bars. The height of each bar is
always the same. Information in my plot is coded in the color of the
bar. I therefore need to be able so assign a different combination
(or order) of colors to each individual stacked bar.
In the example below, the combination of
2010 Nov 08
1
Add text to a stacked barplot
Hi All,
I need some help in putting text in a stacked barplot. The barplot is filled
with 5 levels and now I would like to put text to each level in the stacked
barplot. However, it seems that the code that I am using is not placing the
text at the correct hight (centered at each fill) in the barplot. Any
suggestions to improve the code to make it work?
barchart(FREQ ~ VISIT