I have the following melted data.frame
:
stazione variable value
1 c perc_dati_validi 100
2 i perc_dati_validi 100
3 c min 6
4 i min 6
5 c max 75
6 i max 105
7 c media 25
8 i media 39
9 c 50 24
10 i 50 39
11 c 90 42
12 i 90 60
13 c 95 47
14 i 95 68
15 c 98 53
16 i 98 77
I would like to plot the different numeric variables grouped by stazione
. I'm using:
ggplot(tab22m, aes(x=variable, y=value, fill=stazione))+geom_bar(stat='identity', position='dodge')
The result is the following: ggplot2 plot
The y scale is messed up. I'd wish it to start at zero and end at 105. Any idea? Thank you.
I cannot reproduce your issue.
ggplot(tab22m, aes(x=variable, y=value, fill=stazione)) +
geom_bar(stat='identity', position='dodge')
produces
Make sure that value
is actually a numeric
or integer
vector (check with str(tab22m)
); perhaps somehow value
got turned into a factor
?
tab22m <- read.table(text =
" stazione variable value
1 c perc_dati_validi 100
2 i perc_dati_validi 100
3 c min 6
4 i min 6
5 c max 75
6 i max 105
7 c media 25
8 i media 39
9 c 50 24
10 i 50 39
11 c 90 42
12 i 90 60
13 c 95 47
14 i 95 68
15 c 98 53
16 i 98 77", header = T)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.