Questions tagged [geom-col]

Part of the `ggplot2` library for R, `geom_col` is a chart type using columns to represent data.

169 questions
0
votes
1 answer

geom_col to show a ranking with the lowest number as the tallest bar

I have a dataset of rankings of different items where I want the lowest value to show the tallest bar on the chart. Below is a small sample of the data and the code to build the chart, followed what the chart currently looks like. data <-…
Sam Hoppen
  • 355
  • 2
  • 9
0
votes
1 answer

Manually change order of stacked bar charts in ggplot

I want to manually change the order of stacked bar charts in order to make my labels readable that have so few observations that they are ontop of each other. My goal is to set the order to "unclassified", "Fungi", "Viridiplantae" to set the bars…
mr.raccoon
  • 47
  • 7
0
votes
0 answers

ggplot2: same bar widths when saving pdf

I want all bars to have the same width. My code works when not saving it to a pdf: library(ggplot2) dat <- as.data.frame(mtcars) # convert rownames to a separate column dat <- cbind(rownames(dat), data.frame(dat,…
yPennylane
  • 760
  • 1
  • 9
  • 27
0
votes
1 answer

gganimate horizontal column chart won't transition bars smoothly

I am creating a bar chart race animation using geom_colh from the ggstance package. Right now, the animation is very choppy and doesn't appear to be one continuous animation, instead just one image after another. Below is what the current animation…
Sam Hoppen
  • 355
  • 2
  • 9
0
votes
1 answer

adding legend to a bar plot (R ggplot)

I am trying to add a legend to my bar plot, with no success. This is what my data looks like: three columns, first is a factor with a group name, and than two numeric called "1st_dose" and "2nd_dose" (those are rates of vaccinations among that age…
Artem
  • 3
  • 3
0
votes
1 answer

R: How to group data and assign factor levels within different groups in a dataframe?

structure(list(drug = c("Chlorambucil", "Fludarabine", "FludarabineMafosfamide", "NDI031301", "CMPB", "Tofacitinib", "Peficitinib", "FludarabineMafosfamide", "PDB", "Filgotinib", "Dexamethasone", "CMPA", "Lenalidomide", "Dexamethasone",…
ML33M
  • 341
  • 2
  • 19
0
votes
2 answers

geom_col with position = "dodge" and date on x-axis (multiple values)

I have below data structure "x": # A tibble: 18 x 4 mm mm_fct Legenda waarde 1 2020-07-01 2020-07-01 Gas 0.906 2 2020-07-01 2020-07-01 Temp 17.3 3 2020-08-01 2020-08-01 Gas …
Lucky
  • 29
  • 3
0
votes
1 answer

R: Continuous scale on the x-axis using ggplot

I am trying to plot hourly values on the x-axis (from 00 to 23). However, when trying the code below, it ends up crashing my R Studio. I'm wondering if there's a step I am missing or if I am using the wrong code to achieve this. >…
Joehat
  • 979
  • 1
  • 9
  • 36
0
votes
1 answer

Change axis breaks/limits of ggplot with geom_col

I am having problems with changing the axis ticks in a barplot. I am fairly new in using ggplot so the answer might be very obvious. Here is some data (yes it is strange, but designed to mimic the original dataset I have, which I am not allowed to…
tasel
  • 3
  • 4
0
votes
2 answers

ggplot2 facet_grid: how to fix different spacing between columns in geom_col

I have the dataset with values for different keys for three independent groups and I would like to create a bar plot with these values for 3 different groups using facet_grid. This is what I did so far, however I can not find the way to fix spacing…
Nadya
  • 3
  • 2
0
votes
1 answer

R facet with geom_col?

I have imported the below excel file into the RStudio My goal is to display in a facet of 4 different barplots with x axis representing the categorical variable of algorithms, and y displays the percentages each time as they are counted already in…
user2829319
  • 239
  • 4
  • 16
0
votes
1 answer

How to have separate columns for duplicate x-axis values in geom_col()?

I have a dataframe as below (very simple structure) and I want to draw a column chart to show the amount for each date. The issue is that the date has duplicate entries (e.g., 2020-01-15). # A tibble: 5 x 2 date amount
samsamara
  • 4,630
  • 7
  • 36
  • 66
0
votes
1 answer

Adding catagory labels on a stacked bar chart in R

I am have a made a geom_col() chart in ggplot2 for which I would like to add labels on the bars, but only one per stacked bar. This is what my chart looks like without the labels: gI <- df %>% ggplot(aes(fill = Category, y=csum, x= tijdas)) + …
Slaatje
  • 127
  • 8
0
votes
1 answer

How to change order of overlaid bars with position = "identity" in ggplot2

I'm not very experienced in R and I've been having an issue with geom_col(position = "identity") that I cannot figure out. Here is some obfuscated data that still shows my issue and the code for my graph. #Dataframe print(colorsshapes, n = 30) # A…
Rachel Ward
  • 35
  • 1
  • 3
0
votes
1 answer

How to make bar frame invisible in R for ggplot geom_col function

I am working on making a geom_col plot which has fill colours according to taxa categories, and x would be group and y be abundance, this is my code: sig_counts_rowsample <- data.frame(t(sig_counts))%>% merge(.,anno_col,by=0)%>% …
Eric
  • 53
  • 5