Questions tagged [geom-bar]

`geom_bar` is the geometric object description for creating a barplot in `ggplot2`

geom_bar is the geometric object description for creating a barplot in ggplot2, which is an actively maintained open-source chart-drawing library for R. is written by Hadley Wickham and based upon the principles of "Grammar of Graphics".

Resources for using geom_bar:

1029 questions
-1
votes
1 answer

r ggplot stack identity

enter image description here i want to make this image.. my data is difficult to disclose so i make a arbitrary data.. TnT... data no total outcome 1 800 40 2 700 30 3 650 27 4 600 25 5 500 20 i tried.. ggplot(data,…
이예림
  • 3
  • 1
-1
votes
2 answers

geom bar for multiplay variables (columns) in ggplot

I have a data set with multiplay variables which referes to sympthoms people have (0 exist,1 is not exist) I would like to put all of them in geom bar on x axis, and the y axis will be the count of them in my dataset. ggplot(tested_individuals,…
-1
votes
1 answer

How do I use geom_bar to not take the frecuency of my class but another value?

Im trying to graph the number of bases (A,C,G,T) each of my viruses have on a single histogram. library(readxl) library(ggplot2) Bases <- read_excel("/Users/******/Downloads/BASESCOVID2.xlsx") data<- Bases theme_set(theme_classic()) g <-…
-1
votes
1 answer

How to reduce the spacing between bars without increasing their width in a geom_bar plot made with ggplot2?

I want to reduce the spacing between bars BUT without increasing the width of said bars. I am using the geom_bar function in ggplot2. Someone asked this same question some years ago and provided an example plot (ggplot2 : How to reduce the width AND…
Rachel A.
  • 1
  • 2
-1
votes
1 answer

How to combine multiple ggplot geom_col() into one graph?

Question I am trying to combine three ggplot geom_bar into one geom_bar plot utilising dodge so I can visually compare data across two categorical and one numeric variables. What am I doing wrong? Individual graphs work Each graph works on it's own…
iKcon
  • 71
  • 7
-1
votes
1 answer

Adjusting order of stacked bars in ggplot2

I have not been able to figure this out and have not found a similar question. I would like to show a bar chart where the Y axis is "subject" and then for each subject there is a stacked bar showing the order in which medications were…
-1
votes
1 answer

Re-ordering ggplot according to categorical variable

I am currently using ggplot in R to visualise some rock art data I am working on. My plot shows individual rock art sites (listed with their individual ID, here called SCRAP ID) on the Y-Axis. On the X-Axis, we have the different slope classes (5…
-1
votes
1 answer

Create multiple bar graphs in one bar graph

I have a dataset which looks like the following: my_DataSet <- { # Variable A Variable B Variable C Control Group 1 1 0 0 1 2 1 1 0 1 3 0 0 1 0 } Following Plot multiple boxplot in one graph, I did a transformation (new_DataSet <-…
Narusan
  • 482
  • 1
  • 5
  • 18
-1
votes
1 answer

How to change color (automatically) in geom_line() using R programming language

I have generated a graph using ggplot2 and geom_line(). My graph contains more than 'one' line but all lines are showing only one color (black) but I need different colors for a different line. My code is given below: ggplot(data=data_1,…
mostafiz67
  • 159
  • 1
  • 9
-1
votes
2 answers

R geom_bar with each bar the mean value of subsets of a column

If I have a column with numeric values and I want to create a bar chart with each bar as a mean value of the subset of that column, how can that be done? For example, x1 <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) x1_df <-…
bee5911
  • 516
  • 4
  • 9
-1
votes
1 answer

R Shiny --> Conditionally Highlight Bar Graphs

I am working on a Shiny project to visualize exercise data. This particular menu tab of my dashboard is focused on the cost per exercise class. I have a slider to help determine what my ideal monthly cost per class should be. Two value boxes below…
user2813606
  • 797
  • 2
  • 13
  • 37
-1
votes
1 answer

Overlaying line on Existing barplot

I have a data as shown below: Year PostNumber 2008 2 2009 116 2010 511 2011 1578 2012 2429 2013 1724 2014 1026 2015 648 2016 668 2017 546 2018 496 2019 427 2020 115 I want to plot barplot and a line…
djMohit
  • 151
  • 1
  • 10
-1
votes
1 answer

How to add y axis values on the bar plot in r using ggplot and geom_bar()?

Hi I have been trying to summarize my data set by sum of a particular column and using ggplot and geom_bar() directly to do so instead of using tidyvers and dplyr libraries. I read about weight aesthetic and that it can help plotting bar graph as…
-1
votes
1 answer

reorder barchart as bell curve (density) in R

Lets say I have a data frame : df <- data.frame(x = c("A","B","C"), y = c(10,20,30)) and I wish to plot it with ggplot2 such that I get a plot like a histogram ( where instead of plotting count I plot my y column values from the data frame. ( I…
dvd280
  • 876
  • 6
  • 11
-1
votes
1 answer

Stacked Bar Chart With No Fill?

I have a dataset all set up and am just trying to get a stacked bar chart to show. My X-Axis will show three bars: "left", "middle", and "right" My Y-Axis will be the "total_completed_epa" associated with each of the bars. The only problem is that…
Chives M
  • 15
  • 3