Category "ggplot2"

trouble with labeling axis with strings using ggplot (R)

I'm a college student and we have to create some graphs using Rstudio for an assignment. I've managed to do the core objective for this first task, which is to

Problem while plotting in grouped date values in R

I was trying to plot the max values from a dataset with x-axis = Date and the y-axis = max_value grouped by Stations, like the picture I found on this link, but

Using ggplot2 & geom_bar to change bar color based on 1 factor variable and bar pattern based on another factor variable

I want to use ggplot2 & geom_bar to change bar color based on 1 factor variable and bar pattern based on another factor variable. I can't figure out how to

How can you graph multiple overlapping 18 month periods with daily data?

I am doing an exploratory data analysis for data that is collected at the daily level over many years. The relevant time period is about 18 - 20 months from the

How to fix jagged line from predict_gam in ggplot2?

Data: structure(list(ID = c(19903L, 28185L, 28207L, 28429L, 28522L, 29092L, 29127L, 29219L, 29304L, 30981L, 31166L, 31411L, 32010L, 33231L, 33640L, 33714L, 34

Avoid labels overlap in bar chart

How to avoid my y-axis label overlap in this case(top 5 most frequent words for each year)? Because I may need to change the number of words(ie.top10, top20) la

adding more standard deviations to a plot

I'm trying to add more standard deviation to my current plot. I need to add 1std and 3std, I've already addeed the 2std to my plot. This is my code: tidyverse_

Add text annotations at consistent locations in facet_grid when scale = 'free_y' + ggplot2 + r

I need to annotate a set of chats in a facet grid where the y axis is scale is set to scale = 'free_y'. As the scales are very different, when I set the y posit

How to get x-axis to show all months in dataset

I can't figure out how to customize the x-axis in the graph below. At minimum, I would like each month to be labeled on the x-axis. All help is appreciated. dpu

Specifying fill color independent of mapping aesthetics in boxplot (R ggplot)

I have a lot of categorical variables that are going into a single graph, which is split on a particular status. Something like this, but with many more groups

reorder bar plot by fill in R

How to set this plot in ascending order? many thanks in advance. library(ggplot2) library(reshape2) iris2 <- melt(iris, id.vars="Species"); iris2 ggplot(da

Adding a summary table to facet grid box plot

I am trying to add a table that summarizes the info I have in a facet grid boxplot to the same plot. df<- structure(list(design = c("F", "F", "F", "F", "H",

Plot percentage change figure with 95% CI and stats

I am planning to reproduce the attached figure, but I have no clue how to do so: Let´s say I would be using the CO2 example dataset, and I would like to

Change plot size of rglwidget in shiny

I would like to stretch these plots to the window size or at least make them bigger: ui.R options(rgl.useNULL = TRUE) library(shiny) library(rgl) shinyUI(flui

getting this error Error: Must request at least one colour from a hue palette

enter image description hereIm trying to stack the above given formula to use on my code, but i keep getting this error Error: Must request at least one colour

How do I plot multiple caterpillar plots in one graph in ggplot?

So I have successfully plotted these graphs individually, now I want to create a plot that has all three categories in one graph with same scales but different

How can I draw a similar graph with ggplot2 to find the difference between two works?

I am reading the book Text Mining with R: A Tidy Approach by Julia Silge & David Robinson to try to find the difference between two works, and not the three

Add additional labels from a DataFrame to a facet_grid with existing label

I have a set data that I need to add to levels of labels. One on a single chart within the facet grid, and one from a small dataframe with entries for for each

why ggplot and geom_tile create lines on the map?

Data: https://github.com/yuliaUU/data/blob/main/test.csv griddf <- read_csv("test.csv") create a map: world <- rnaturalearth::ne_countries(scale = "medi

how to add density line over real count value (maybe with 2 y-axis)

I would like to plot a density plot over counts histogram using following sample data: However my density line was not readable in my plot. if I use ..ncount..,