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
0 answers

ggplot and geom_col with position dodge in R is only plotting the max value in my data, rather than the sum value

ggplot(data=enroll2, aes(x=ACTUAL_ENRL, y=DEPT, fill=Term))+geom_col(position="dodge", width = 0.60) this results in result I need the chart to resemble the following (charted with python): python chart - same data Data looks like the…
JTAR
  • 11
  • 2
0
votes
1 answer

Assigning specific colors to columns in geom_col()

I produced a geom_col() that has 13 separate columns on it. I would like to assign a specific color to the columns: for example, I have "Teams" on the x axis, and "AVG Attendance" of the teams on the y axis. Of the 13 teams, I would like my specific…
mrax25
  • 1
  • 2
0
votes
1 answer

R ggplot- na.rm is not removing the record

I am not sure why "na.rm=TRUE" in ggplot() and geom_col() don't remove the missing. Here is the input file (file name in the code is dat.csv…
0
votes
1 answer

ggplot2: Issue with y-axis when generating graph with geom_col

I came back to R to make some graph for publication figure. However, I'm quite rusty and still in the learning process and I'm struggling on bar/col-based graph generation. Context: Basically we have result of in vitro assays made with different…
0
votes
2 answers

Is it possible to make a column plot using ggplot in which the column fill is controlled by a third variable?

I have a data frame with three continuous variables (x,y,z). I want a column plot in which x defines the x-axis position of the columns, y defines the length of the columns, and the column colors (function of y) are defined by z. The test code…
Fleetboat
  • 189
  • 7
0
votes
0 answers

How to get percentage values in ggplot with 2 variables

I am currently working on a project regarding buying behaviour. First I need to filter the data set because I only want to look at data which has a specific variable at one. Then I want to plot the data from this specific variable, distinguishing…
Chris
  • 1
  • 1
0
votes
1 answer

geom_text() is not labeling geom_col correctly

I am trying to label columns with geom_text() on a geom_col() however, the labels (numbers) are not printing out correctly, nor positioning the way I would like them to. vjust does not seem to be working as I wanted the labels to be at the top of…
Janos
  • 3
  • 2
0
votes
2 answers

Display percentages within category and also for entire sample with ordinal variable in facets

I'm trying to modify @DaveArmstrong 's answer to this question because I'm also trying to display the percent for the entire sample, aka for White, Black, Hispanic, and Other together, and display that next to each individual race (calling it "all"…
a_todd12
  • 449
  • 2
  • 12
0
votes
1 answer

Plotting position="identity" geom_col in ggplot2 - some series hiding behind others i.e. not visible

I'm trying to plot an annual time series in bar-chart format. I have 7 sets of yearly data, and they are in a set order (so, the same dataset has the lowest value each year, and the same dataset is highest value each year) I can plot it as a line…
Greg
  • 39
  • 6
0
votes
1 answer

How to add geom_col to my code appropriately

datapasta::df_paste(head(df,45)[,c('A.','Object','Colour')]) #> Error in unclass(x)[...]: subscript out of bounds data.frame( stringsAsFactors = FALSE, A. = c(113,34,NA,9,11,28,41,66,12,23.2, …
Eugene E
  • 13
  • 3
0
votes
1 answer

Calculating percentages within category using geom_col

This has been asked in various forms before, but I'm attempting it in a slightly different way and can't seem to get it exactly right. When I use this code: d %>% drop_na(attend) %>% count(race, attend) %>% group_by(race) %>% …
a_todd12
  • 449
  • 2
  • 12
0
votes
1 answer

geom_col in R making bars next to each other

With the following code A2c%>% group_by (maritalStatus, Geschlecht)%>% summarise (nbr_total=n(), nbr_adipos=sum(Adipös))%>% mutate( adipos_prozent = 100 * nbr_adipos / nbr_total )%>% filter (maritalStatus != "Refused")%>% ggplot+ …
George
  • 13
  • 3
0
votes
1 answer

why is ggplot2 geom_col misreading discrete x axis labels as continuous?

Aim: plot a column chart representing concentration values at discrete sites Problem: the 14 site labels are numeric, so I think ggplot2 is assuming continuous data and adding spaces for what it sees as 'missing numbers'. I only want 14 columns with…
Paul
  • 5
  • 3
0
votes
1 answer

in ggplot2()/geom_col, how to change stack bar retangular sequence and fill color

In below plot , 1) How to align category 'A' to axis x (axis y start from 0)? 2) How to change sub_category fill color ? want change to 'pink' (whis the color samilar to category color) . Anyone can help? library(tidyverse) plot_data <-…
anderwyang
  • 1,801
  • 4
  • 18
0
votes
1 answer

How do you recenter y-axis at 0.01 using ggplot2

I am trying to make a grouped bar plot comparing the concentration of contaminants (in ug/g) from 2 different locations site comparison figure, with the y axis in log scale. I have some values that are below one but greater than zero. The y axis is…
STay
  • 3
  • 1