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 to vertically or horizontally adjust label for only some bars in ggplot2 geom_col
I have created a graph (run code below) and I would like to adjust the position (using hjust) for only two of the bars ("Difficult" and "Very Difficult") so that their labels appear outside (to the right) of the bars.
Is there a way to only adjust…

Bob_123
- 19
- 3
0
votes
1 answer
geom_col issue: `position_stack()` requires non-overlapping x intervals
I have a dataframe df:
df <- data.frame (group = c("east", "west"),
value = c(1/3, 2/3)
)
d <- data.frame(x = rep(df$value, times = c(2,1))) %>%
ggplot(aes(x = x, y = 1, fill = x)) +
geom_col(position = 'stack', color =…

MicL
- 67
- 1
- 8
0
votes
0 answers
Using magick to add pattern to specific bars
I am trying to add a pattern from magick to only specific bars on my graph. I want to make it so that within the Chemical group of ASM and UNT that only the ASM bars have a checkerboard pattern and the UNT bars are just filled with the colors I have…

sweetlu
- 1
- 2
0
votes
1 answer
Order columns in plot
I'd like to make a stocked graph with geom_col() with below dataset.
tmp.df <- data.frame(
original = c(2.68, 1.05, 72.89, 11.81, 11.67, 2.85, 1.11, 72.74, 12.05, 11.95),
sensitivity = c('Si', 'Si', 'Si', 'Si', 'Si', 'STi', 'STi', 'STi', 'STi',…

S. Jeon
- 5
- 2
0
votes
1 answer
Creating a bar plot using geom_col() and coord_flip()
Using the below dataset, I would like to create the image pasted below. I tried the following code but it returned a plot that is not even close to the plot I need.
My data
structure(list(UWLE = structure(c(0.600000023841858, 0.600000023841858,…

Nader Mehri
- 514
- 1
- 5
- 21
0
votes
1 answer
How to plot one thick bar on x-axis representing all values geom_col ggplot2
How do I re-plot the below geom_col where Group 1 and Group 2 have one thick bar each, rather than multiple thin bars that all show exactly the same result?
This is the data I am plotting:
structure(list(mean_group = c(0.263699696150573,…

MeganCole
- 39
- 1
- 6
0
votes
2 answers
How can I add a blocked colour legend to my bar graph in R?
I am generating a bar graph to show mutation frequency by dose for a specific dataset.
Underneath the bar chart I would like to include a colour block type legend that corresponds to the dose of each bar. I have included a figure (made using excel…

DLBScripts
- 1
- 1
0
votes
1 answer
Putting geom_col in specific order
I have some (admittedly chaotic) data and am trying to wrangle it into a figure using the code below. There are 2 things that I am struggling with.
I want to change how test_level is displayed in the figure, so that 0 is "Test Under", 1 is "Test…

a_todd12
- 449
- 2
- 12
0
votes
1 answer
how to change `TRUE` and `FALSE` labels in ggplot2 generated by geo_col?
the data: dput(gsea)
structure(list(ID = c("ab1", "ab2", "ab3", "ab4", "ab5", "ab6",
"ab7", "ab8", "ab9", "ab10", "ab11", "ab12", "ab13", "ab14",
"ab15", "ab16", "ab17", "ab18", "ab19", "ab20"), Count = c(183L,
37L, 15L, 30L, 38L, 98L, 49L,…
user2110417
0
votes
0 answers
How to align geom_text labels on geom_col() properly?
I am trying to label columns with geom_text() on a geom_col(). But, the labels (numbers) doesn't labeled the columns properly. It seems that the hjust values are different from each other.
Dataset:…

Ali Osman
- 17
- 4
0
votes
2 answers
Merging Two Geom_Col Plots
I have two geom_col graphs and I want to merge each of the bars side by side in one graph.
df<-data.frame(names=c("A","B","C","D","E","F","G","H","I"),…

Kübra Çelikbaş
- 3
- 1
0
votes
1 answer
Rescale y-axis with geom_col and position=fill in ggplot2 to combine with line plot
I am trying to overlay a line plot and column plot. I am using geom_col with position=fill, such that its y-axis goes from 0 to 1. However, the line plot's y-scale is quite different (approx. 20-50) so when combined the column plot is practically…

TY Lim
- 509
- 1
- 3
- 11
0
votes
1 answer
Ordering y axis by another variable in a ggolot bar plot
I have a swimlane plot which I want to order by a group variable. I was also wondering if it is possible to label the groups on the ggplot.
Here is the code to create the data set and plot the data
dataset <- data.frame(subject = c("1002", "1002",…

APP
- 25
- 4
0
votes
1 answer
Pyramind Plot using ggplot2 in R
I need help in removing/converting the negative values in the x-axis of the pyramid plot.
I was able to build the pyramid through https://walker-data.com/census-r/exploring-us-census-data-with-visualization.html subheading 4.5.2. I keep getting an…

Eddie
- 35
- 6
0
votes
1 answer
cannot run ggplotly on a geom_col
This is the data https://github.com/Clairinechendra/sbucks1010/blob/main/p3.csv
Below is my code
p3_plot <- p3 %>%
ggplot(aes(x= size_ml, y= n, fill= category))+
geom_col(position="stack") +
theme_light()
ggplotly(p3_plot)
everytime i run…

Clairine
- 23
- 5