no side by side bars are shown using ggplot
up vote
1
down vote
favorite
My question is related with this one:
Side-by-side bars in bar plot
I am trying to do the same kind of thing, but I just don't get any data, the axis are filled in. But no visualised graph. I tried to remoddel the data in small steps, but it still did not worked out. I have no clue, why the data is not shown.
n<-15
data <- data.frame("number" = c(1:n),
"Nasal" = c(15.4, 13.5, 13.3, 12.4, 12.8,
13.5, 14.5, 13.9, 11.0, 15.0,
17.0, 13.8, 17.4, 16.5, 14.4),
"Endob" = c(16.5, 13.2, 13.6, 13.6, 14.0,
14.0, 16.0, 14.1, 11.5, 14.4,
16.0, 13.2, 16.6, 18.5, 14.5))
library(ggplot2)
method<-rep(c("Nasal","Endob"),each=n)
values<-c(data$Nasal, data$Endob)
patient<-factor(c(1:15))
data2<- data.frame(patient,method,values)
data2
ggplot(data2, aes(x=factor(patient), fill=method, y=values))
geom_bar(position ="dodge",stat="identity")
r ggplot2 geom-bar
add a comment |
up vote
1
down vote
favorite
My question is related with this one:
Side-by-side bars in bar plot
I am trying to do the same kind of thing, but I just don't get any data, the axis are filled in. But no visualised graph. I tried to remoddel the data in small steps, but it still did not worked out. I have no clue, why the data is not shown.
n<-15
data <- data.frame("number" = c(1:n),
"Nasal" = c(15.4, 13.5, 13.3, 12.4, 12.8,
13.5, 14.5, 13.9, 11.0, 15.0,
17.0, 13.8, 17.4, 16.5, 14.4),
"Endob" = c(16.5, 13.2, 13.6, 13.6, 14.0,
14.0, 16.0, 14.1, 11.5, 14.4,
16.0, 13.2, 16.6, 18.5, 14.5))
library(ggplot2)
method<-rep(c("Nasal","Endob"),each=n)
values<-c(data$Nasal, data$Endob)
patient<-factor(c(1:15))
data2<- data.frame(patient,method,values)
data2
ggplot(data2, aes(x=factor(patient), fill=method, y=values))
geom_bar(position ="dodge",stat="identity")
r ggplot2 geom-bar
You are mising a plus sign at the end of theggplot
instruction. You need to add thegeom_bar
to the plot.
– Rui Barradas
Nov 11 at 19:56
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
My question is related with this one:
Side-by-side bars in bar plot
I am trying to do the same kind of thing, but I just don't get any data, the axis are filled in. But no visualised graph. I tried to remoddel the data in small steps, but it still did not worked out. I have no clue, why the data is not shown.
n<-15
data <- data.frame("number" = c(1:n),
"Nasal" = c(15.4, 13.5, 13.3, 12.4, 12.8,
13.5, 14.5, 13.9, 11.0, 15.0,
17.0, 13.8, 17.4, 16.5, 14.4),
"Endob" = c(16.5, 13.2, 13.6, 13.6, 14.0,
14.0, 16.0, 14.1, 11.5, 14.4,
16.0, 13.2, 16.6, 18.5, 14.5))
library(ggplot2)
method<-rep(c("Nasal","Endob"),each=n)
values<-c(data$Nasal, data$Endob)
patient<-factor(c(1:15))
data2<- data.frame(patient,method,values)
data2
ggplot(data2, aes(x=factor(patient), fill=method, y=values))
geom_bar(position ="dodge",stat="identity")
r ggplot2 geom-bar
My question is related with this one:
Side-by-side bars in bar plot
I am trying to do the same kind of thing, but I just don't get any data, the axis are filled in. But no visualised graph. I tried to remoddel the data in small steps, but it still did not worked out. I have no clue, why the data is not shown.
n<-15
data <- data.frame("number" = c(1:n),
"Nasal" = c(15.4, 13.5, 13.3, 12.4, 12.8,
13.5, 14.5, 13.9, 11.0, 15.0,
17.0, 13.8, 17.4, 16.5, 14.4),
"Endob" = c(16.5, 13.2, 13.6, 13.6, 14.0,
14.0, 16.0, 14.1, 11.5, 14.4,
16.0, 13.2, 16.6, 18.5, 14.5))
library(ggplot2)
method<-rep(c("Nasal","Endob"),each=n)
values<-c(data$Nasal, data$Endob)
patient<-factor(c(1:15))
data2<- data.frame(patient,method,values)
data2
ggplot(data2, aes(x=factor(patient), fill=method, y=values))
geom_bar(position ="dodge",stat="identity")
r ggplot2 geom-bar
r ggplot2 geom-bar
asked Nov 10 at 23:03
Hautekiet
83
83
You are mising a plus sign at the end of theggplot
instruction. You need to add thegeom_bar
to the plot.
– Rui Barradas
Nov 11 at 19:56
add a comment |
You are mising a plus sign at the end of theggplot
instruction. You need to add thegeom_bar
to the plot.
– Rui Barradas
Nov 11 at 19:56
You are mising a plus sign at the end of the
ggplot
instruction. You need to add the geom_bar
to the plot.– Rui Barradas
Nov 11 at 19:56
You are mising a plus sign at the end of the
ggplot
instruction. You need to add the geom_bar
to the plot.– Rui Barradas
Nov 11 at 19:56
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
I think it runs fine, you just forgot the +
between ggplot
and geom_bar
.
ggplot(data2, aes(x=factor(patient), fill=method, y=values)) +
geom_bar(position ="dodge",stat="identity")
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
I think it runs fine, you just forgot the +
between ggplot
and geom_bar
.
ggplot(data2, aes(x=factor(patient), fill=method, y=values)) +
geom_bar(position ="dodge",stat="identity")
add a comment |
up vote
0
down vote
accepted
I think it runs fine, you just forgot the +
between ggplot
and geom_bar
.
ggplot(data2, aes(x=factor(patient), fill=method, y=values)) +
geom_bar(position ="dodge",stat="identity")
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
I think it runs fine, you just forgot the +
between ggplot
and geom_bar
.
ggplot(data2, aes(x=factor(patient), fill=method, y=values)) +
geom_bar(position ="dodge",stat="identity")
I think it runs fine, you just forgot the +
between ggplot
and geom_bar
.
ggplot(data2, aes(x=factor(patient), fill=method, y=values)) +
geom_bar(position ="dodge",stat="identity")
answered Nov 10 at 23:09
seisdrum
1765
1765
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244279%2fno-side-by-side-bars-are-shown-using-ggplot%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You are mising a plus sign at the end of the
ggplot
instruction. You need to add thegeom_bar
to the plot.– Rui Barradas
Nov 11 at 19:56