geom-bar Questions
1
I created a ggplot2 bar plot and added a label, with the bar y-value, above the bar.
d <- data.frame(
Ano=2000+5*0:10,
Populacao =c(6.1,6.5,6.9,7.3,7.7,8.0,8.3,8.6,8.9,9.1,9.3)
)
d %>% g...
1
Solved
I am trying to use ggplot to plot a frequency plot where the dropped values still show in the legend. I have been able to achieve this by setting drop = FALSE in scale_fill_manual, however the drop...
4
Solved
I have a basic bar graph I've created from ggplot2. The y variable contains both positive and negative values and about half the vector of values are negative. I would like to customize the axis la...
3
Solved
How to make the width of bars and spaces between them fixed for several barplots using ggplot, having different number of bars on each plot?
Here is a failed try:
m <- data.frame(x=1:10,y=runi...
2
Solved
I'm trying to produce a stacked column chart with data labels.
I'm able to produce the chart, but was unable to find a way to input data labels. I have tried geom_text() but it keeps asking me to i...
2
Solved
I have the following in order to bar plot the data frame.
c1 <- c(10, 20, 40)
c2 <- c(3, 5, 7)
c3 <- c(1, 1, 1)
df <- data.frame(c1, c2, c3)
ggplot(data=df, aes(x=c1+c2/2, y=c3)) +
ge...
3
I have created a facet plot using ggplot which has 4 rows and 1 column with this code:
ggplot(data=c, aes(x=Time, y=X.mean, fill = Site, width=.1)) +
geom_bar(stat="identity", position=position_...
Ablebodied asked 8/1, 2014 at 11:6
5
Solved
I am trying to generate a barplot such that the x-axes is by patient with each patient having multiple samples. So for instance (using the mtcars data as a template of what the data would look like...
4
Solved
I have searched and searched, but I cant seem to find an elegant way of doing this!
I have a dataset Data consisting of Data$x (dates) and Data$y (numbers from 0 to 1)
I want to plot them in a ba...
2
Solved
I am conducting a study of a number of patients with a disease, and using an ordinal scale assessment of functional status at 3 different time points. I want to connect multiple groups in stacked b...
Gatefold asked 24/1, 2022 at 16:42
3
Solved
I would like to plot a time series using bar charts and have the Bin Width set to 0.9. I cannot seem to be able to do that however. I have searched around but could not find anything helpful so far...
Davidadavidde asked 16/6, 2015 at 2:29
3
Solved
I have a dataframe d:
> head(d,20)
groupchange Symscore3
1 4 1
2 4 2
3 4 1
4 4 2
5 5 0
6 5 0
7 5 0
8 4 0
9 2 2
10 5 0
11 5 0
12 5 1
13 5 0
14 4 1
15 5 1
16 1 0
17 4 0
18 1 1
19 5 0
20 4 0
Th...
1
Solved
I want to plot multiple categories on a single graph, with the percentages of each category adding up to 100%. For example, if I were plotting male versus female, each grouping (male or female), wo...
2
Solved
The goal is to get rid of the space between the tick marks and the base of the bars without cutting off any of the percentage labels beyond the other end of the bars.
I am running dozens of bar gr...
1
This is a simple example of what my barplot look like :
x <- data.frame(aa=c(0.2,0.6,0.1), dd = c(1,2,3))
x <- melt(x, "dd")
y <- data.frame(bb=c(0.4,0.5), dd = c(1,2))
y <- melt(y, "...
4
Solved
I have a dataframe in R that I want to plot in a faceted ggplot bar chart.
I use this code in ggplot:
ggplot(data_long, aes(x = partei, y = wert, fill = kat, width=0.75)) +
labs(y = "Wählera...
2
Solved
In this bar chart for the specific viridis option is it possible to set of color which can show the numbers inside the chart clear even for the darker option of the scale?
library(ggplot2)
Year <...
3
Solved
I have a question concerning the fill field in geom_bar of the ggplot2 package.
I would like to fill my geom_bar with a variable (in the next example the variable is called var_fill) but order th...
2
I'm aiming at building a bar plot with arrows at the end of bars. I went for geom_segment with arrow defined. I want to map one column onto transparency, but the alpha aesthetic doesn't seem to wor...
1
Solved
I want to have a stacked barplot with percentages in it based on counts.
I have almost reached what I want but every value in the text is 100% instead of the real percentage ...
I think there is on...
3
I'm trying to make a bar graph (with geom_bar) of ratios, and would like to set the x-axis at y=1. Therefore, ratios <1 would be below the axis and ratios >1 would be above the axis. I can do so...
1
Solved
I have some data that captures percentages of two different groups over multiple time periods.
df <- structure(list(period = structure(c(1L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L), .Label = c("F...
2
Solved
I am learning geom_bar on section 3.7 of r4ds.had.co.nz. I run a code like this:
library(ggplot2)
ggplot(data = diamonds) + geom_bar(mapping = aes(x = cut, y = ..prop.., group = 1))
Then I have ...
4
Solved
I've seen many questions (often linked to Order Bars in ggplot2 bar graph) about how to (re)order categories in a bar plot.
What I am after is just a touch different, but I haven't found a good wa...
1
Solved
I have a barplot where the exact bar heights are in the dataframe.
df <- data.frame(x=LETTERS[1:6], y=c(1:6, 1:6 + 1), g=rep(x = c("a", "b"), each=6))
ggplot(df, aes(x=x, y=y, fill=g, group=g)...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.