Part of the `ggplot2` library for R, `geom_col` is a chart type using columns to represent data.
Questions tagged [geom-col]
169 questions
0
votes
1 answer
How do you find stats of a column chart in R?
My dataset has 2 variables :
1)Match_City (name of the city where a soccer match is played)
2) Home_score (number of goals by the home team)
The problem is there more than 1500 cities and it's not possible to make out which cities have the highest…

Ishwar Jagdish Ashar
- 13
- 3
0
votes
1 answer
My bar plots are automatically reordered in an order that is not consistent with my data frame
I'm using ggplot to make bar graphs of data. I have everything ordered as I want it in my data frame but when I plot it, it is rearranged in some random order. How do I tell it to leave the bars in the order of the data frame? Thank you
iris Example…

bob ox
- 1
- 3
0
votes
1 answer
Arrange x-axis in ascending order
I am trying to plot in a stacked bar chart the accumulative cost of seven different units, using ggplot2 and geom_col. The challenge I have is when I plot the data, in the x-axis I do not get the units in an ascending order.
> b1
Unit variable …

Aloft
- 1
- 2
0
votes
0 answers
Labels don't center with horizontal stacked bar (geom_col and position_fill)
I want to create a horizontal stacked bar plot with geom_col. I can get it almost right, exact that the labels are not centered. I tried different combinations of aes arguments on the geom_text function, but up until now, no success. This is the…

SHW
- 461
- 7
- 26
0
votes
1 answer
How to change bar plot to line plots
This question may already have an answer here.
I am new to R and I would like to plot the weekly timing of different activities using geom_line.
My data structure is:
structure(list(time = structure(c(25L, 26L, 27L, 28L, 29L, 30L,
31L, 32L, 33L,…

Rfanatic
- 2,224
- 1
- 5
- 21
0
votes
0 answers
Fix distance to bars from edges of x-axis within theme function ggplot
I created my own theme so that me and my colleagues get saved tons of time :). I am looking for a way to fix the distance from the edges of the x-axis to the bars within the theme function. As I run the script below, the distance between the y-axis…

SHW
- 461
- 7
- 26
0
votes
0 answers
Imposing normal distribution to column bars by factor
I have a dataframe with 3 columns and several rows, with this structure
Label Year Frequency
1 a 1 86.45
2 b 1 35.32
3 c 1 10.94
4 a 2 13.55
5 b 2 46.30
6 c 2…

D.K.
- 47
- 7
0
votes
1 answer
Sort or order multiple bars with geom_col barplot
I have this kind of table:
Year Substance Number
2013 A 32
2013 B 27
2013 C 17
2013 D 17
2013 E 15
2013 F 13
2014 B 20
2014…

Lora
- 3
- 2
0
votes
1 answer
R: Adjust the values of the X-axis based on the Y-values in a bar-plot
According to the following R code, the data frame Results is grouped by the Industry variable and for each one of them I calculate the number of cases/observations. After that I create a bar plot where the X axis displays the industries while the Y…

Whitebeard13
- 411
- 1
- 7
- 17
0
votes
1 answer
Can't use geom_col to plot POSIXct object?
I have the dataset :
vec=c("1960-01-01 06:39:00","1960-01-01 05:10:00","1960-01-01 04:30:00","1960-01-01 02:53:00")
vec=as.POSIXct(vec, origin="1960-01-01", tz = "GMT")
dum=data.frame(v1=c("a","b","c","d"),v2=vec)
If I try to built a plot with a…

Doe
- 27
- 4
0
votes
1 answer
Creating proportional figures for geom_text, when using faceted geom_col, and position="fill"
I am trying to use geom_text to label a faceted geom_col plot where the position="fill".
This is a simplified version of the data I am using:
group = c("Group1", "Group1", "Group1", "Group1", "Group1", "Group1","Group2", "Group2", "Group2",…

user10022403
- 91
- 7
0
votes
2 answers
ggplot geom_col: automatically defining y from data?
I have a dataframe that looks like that:
A B C
0,868385346 0,628248588 0,468926554
0,074626866 0,277966102 0,271186441
0,024423338 0,057627119 0,203389831
0,017639077 0,007909605 0,011299435
0,004070556 0,007909605…

Gemini1096
- 21
- 1
- 4
0
votes
1 answer
How can I correctly position the geom_text labels to these geom_col data?
I am unable to get the labels to fit properly over each dodged bar in this chart:
I feel that I am almost there, but can't quite figure out how to get the labels perfectly positioned over each respective dodged bar.
Code:
ggplot() +
geom_col(data…

Mus
- 7,290
- 24
- 86
- 130
0
votes
1 answer
Why are only some of the tick marks showing and how can I show all of them?
I have a chart that shows a week's worth of data.
The trouble is that it doesn't show all of the date values on the axis (code is below):
How can I fix this to show all 7 date values?
Code:
Dataset:
us_chats <- structure(list(date =…

Mus
- 7,290
- 24
- 86
- 130
-1
votes
2 answers
ggplot2 bar plot color changing
enter image description hereenter image description hereI wanted to make a bar graph with ggplot. I specify the order and colors for "fill" but one bar's order and color do not change. Here are my codes:
ggplot(data) +
geom_col(mapping = aes(x =…

Elmira
- 1
- 2