Displaying 20 results from an estimated 9000 matches similar to: "ggplot2 geom_bar arrangement"
2017 Jun 27
0
ggplot2 geom_bar arrangement
You just have to change the levels of the factor ...
library(ggplot2)
Lab = c(letters[4:6], letters[1:3])
valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4)
df <- data.frame(Lab,valuex)
# set the factor levels to the same order as observed in the data frame
df$Lab <- factor(df$Lab, levels=unique(df$Lab))
px <- ggplot(df,aes(Lab,valuex,label=Lab)) +
geom_text(aes(y=0)) +
geom_bar(stat =
2017 Jun 27
0
ggplot2 geom_bar label justification
Hi,
I was trying to make a horizontal bar plot. The barplot works when the text
labels are of reasonable length, but not if some of them are slightly long.
I think the long ones get 'squeezed' by default before the plot is flipped
and keep the skew after the flip. Is there a way I can get around this?
In the code below, plot px looks just fine, but the labels get staggered in
plot py.
2010 Sep 01
2
ggplot2 multiple group barchart
hi there.. i got a problem with ggplot2.
here my example:
library (ggplot2)
v1 <- c(1,2,3,3,4)
v2 <- c(4,3,1,1,9)
v3 <- c(3,5,7,2,9)
gender <- c("m","f","m","f","f")
d.data <- data.frame (v1, v2, v3, gender)
d.data
x <- names (d.data[1:3])
y <- mean (d.data[1:3])
pl <- ggplot (data=d.data, aes (x=x,y=y))
pl
2013 Oct 30
1
ggplot2 - how to get rid of bar boarder lines
Hello!
I am using ggplot2:
ggplot(myplotdata, aes(x=att_levels, y=WTP)) +
geom_bar(stat="identity",fill="dark orange",colour="black",
alpha = 1,position = "identity") +
geom_text(aes(label=WTP),colour="black",size=4,hjust=1.1,position='dodge') +
coord_flip() +
xlab("") +
2012 Jun 06
2
ggplot2: legend for geom_rug() ..?
Hi,
I was trying to make another legend for the rug plot. Sample code:
library(ggplo2)
ids <- paste('id_',1:3,sep='')
before <- sample(9)
after <- sample(1:10,9)
dat <- as.matrix(cbind(before,after))
rownames(dat) <- rep(ids,3)
position <- c(rep(10,3),rep(13,3),rep(19,3))
mdat <- cbind(melt(dat),position)
ggplot(mdat, aes(position, value)) +
2009 Feb 11
2
Label bars in a faceted bar plot in ggplot2
Hi List,
I am running R 2.8.0 on a Windows XP machine, running ggplot2 version 0.8.1
I want to label the bars in a faceted grid barplot. Reproducible R
code is given below:
#### reproducible facet barplot #####
library(ggplot2)
# Dataset from which to create the barplot
ml <- rep(1:10,2)
vals <- rnorm(20,mean = 10, sd=1)
type <- c(rep("MAPE",10),rep("AIC",10))
2009 Mar 30
2
ggplot2-geom_text()
Hi: I need help with geom_text().
I would like to count the number of Locations
and put the sum of it right above each bar.
x <- "Location Lake_dens Fish Pred
Lake1 1.132 1 0.115
Lake1 0.627 1 0.148
Lake1 1.324 1 0.104
Lake1 1.265 1 0.107
Lake2 1.074 0 0.096
Lake2 0.851 0 0.108
Lake2 1.098 0 0.095
Lake2 0.418 0 0.135
Lake2 1.256 1 0.088
Lake2 0.554 1 0.126
Lake2 1.247 1 0.088
2013 Apr 30
1
Stacked geom_bar with aggregated SE -ggplot2
Hi there,?
I've been battling with an extension of this in my own data: getting
appropriate error bars once data is stacked in a bar graph.?
(original question:
http://r.789695.n4.nabble.com/ggplot2-se-variable-in-geom-errorbar-s-limits-
td3311176.html). It wouldn't let me reply to that thread.
A modification of the earlier answer:?
data(diamonds)?
?diamonds_df <- ddply(diamonds,
2011 Nov 16
1
geom_bar with missing data in package ggplot
Dear all,
I was hoping someone could help with a ggplot question. I would like
to generate a faceted bar chart, but missing data are causing
problems.
g<-structure(list(Date = structure(c(11322, 11687, 12052, 11322,
11687, 12052, 11322, 11687, 12052, 11322, 11687, 12052), class = "Date"),
variable = c("Govt Revenues to GDP", "Govt Revenues to GDP",
2013 Oct 30
1
ggplot2 question: keeping the order as in the input data
Hello!
I am using ggplot2 (see the code below) to plot the data in 'myplotdata'.
The first column of 'myplotdata' is called "att.levels" and contains
strings; the second column is called "WTP" and contains numeric values.
Notice - I use 'coord.flip()'
The command aes(x=att_levels, y=WTP), if I understand correctly, sorts
things alphabetically based on
2012 Apr 23
1
ggplot2 - geom_bar
Hello,
I've some problem with the ggplot2. Here's a small example:
--8<--
library(ggplot2)
molten <- data.frame(date=c('01','01','01','01',
'02','02','02','02'),
channel=c('red','red','blue','blue',
2010 Nov 11
2
Number above the bar?
Hi
I got an barplot, and I would like to have the exact number of the bars just
above the bars anyone know how to do this?
Sorry for bad English, and I do hope that you understand what im after.
//Joel
--
View this message in context: http://r.789695.n4.nabble.com/Number-above-the-bar-tp3037438p3037438.html
Sent from the R help mailing list archive at Nabble.com.
2012 Aug 10
1
ggplot2 geom_bar produces white slashes in legend keys
When I am using geom_bar I get these white slashes through the legend keys. I cannot figure out how to remove them.
ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar()
I have tried using opts(legend.key = theme_blank()) but with no luck.
Any suggestions would be much appreciated.
I am using R vers. 2.15.0 and ggplot 0.9.1, win xp
Best wishes
Jonas Hal
2009 Jul 16
2
GGPLOT Clipping Regions
Hi there,
I'm trying to find out the command to stop clipping to plot region in
ggplot.
I have a bar chart (axis flipped) with labels on the bars, but the
labels are clipped at the plot region box.
I know it's possible to turn this off for base and lattice, but how
about ggplot?
par(xpd=NA)
The ggplot2 manual doesn't seem to mention it, and a search for
ggplot and
2009 Jan 24
2
ggplot2 - how to change location / position of wind rose axis labels?
Dear R users,
First just want to say thank you to all for developing such a wonderful
software and packages.
I need to produce a wind rose plot. Tried with packages circular and plotrix
and couldn't quite get what I want. Moved to package ggplot2 and it's going
great. However stuck in how to move axis labels.
I am using the wind rose from the help to learn how to do what I need (code
2012 Feb 06
1
ggplot2 geom_polygon fill
Hi everyone,
i've been trying to make a special plot with ggplot2, but I can't get it to
fill the polygon I'd like to see filled so very very much.
I want to display the difference or change in the distribution of the
modified Rankin Scale between two groups. mRS is a scale for disability or
daily activities competence.
It looks like this.
2017 Jul 27
3
na.rm = T treatment by ggplot2's geom_bar
Hello!
I am trying to understand how ggplot2's geom_bar treats NAs.
The help file says:
library(ggplot2)
?geom_bar
na.rm: If FALSE, the default, missing values are removed with a warning. If
TRUE, missing values are silently removed.
I am trying it out:
md <- data.frame(a = c(letters[1:5], letters[1:4], letters[1:3], rep(NA,
3)))
str(md); levels(md$a)
ggplot(data = md, mapping = aes(x =
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
To clarify: my question is not about "who could I exclude NAs from being
counted" - I know how to do that.
My question is: Why na.rm = T is not working for geom_bar in this case?
On Thu, Jul 27, 2017 at 8:24 AM, Dimitri Liakhovitski <
dimitri.liakhovitski at gmail.com> wrote:
> Hello!
>
> I am trying to understand how ggplot2's geom_bar treats NAs.
> The help file
2017 Jul 27
1
na.rm = T treatment by ggplot2's geom_bar
I suspect this is by design. Questions about "why" should probably cc the contributed package maintainer(s).
--
Sent from my phone. Please excuse my brevity.
On July 27, 2017 7:49:47 AM PDT, Dimitri Liakhovitski <dimitri.liakhovitski at gmail.com> wrote:
>To clarify: my question is not about "who could I exclude NAs from
>being
>counted" - I know how to do
2017 Jul 27
2
na.rm = T treatment by ggplot2's geom_bar
Just a thought:
Did you try na.rm = TRUE in case you have an object named "T" in scope?
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Thu, Jul 27, 2017 at 7:49 AM, Dimitri Liakhovitski
<dimitri.liakhovitski at