Category "ggplot2"

How to adjust facet size manually

I have a faceted plot with very diverse data. So some facets have only 1 x value, but some others have 13 x values. I know there is the parameter space='free' w

plotting geom_text() with free scale facet_wrap

I would like to plot geom_text() in a facet_wrap with scale = free. I tried to use geom_blank() or, set each height on each graph, but it was not successful. Wo

Density plot based on time of the day

I've the following dataset: https://app.box.com/s/au58xaw60r1hyeek5cua6q20byumgvmj I want to create a density plot based on the time of the day. Here is what

How to connect across multiple consecutive missing data values using geom_line?

I have a similar problem to Q: Connecting across missing values with geom_line, but found the answers provided only connect the lines when there is one missing

Stripping mapping such as colour and line type from an existing ggplot2 object to re-do it

Within a Shiny application, I would like to provide users the option to select a regression method and then show the fit on their data on an existing ggplot2 gr

Overlaying jittered points on boxplot conditioned by a factor using ggplot2

I am making a boxplot conditioned by a factor similar to this example: p <- ggplot(mtcars, aes(factor(cyl), mpg)) p + geom_boxplot(aes(fill = factor(am)))

R plotly - Plotting grouped lines

I am migrating over from ggplot2 to plotly, in order to take advantage of the interactive features they offer. I do realize that the plotly library has a ggplo

Computation failed for stat_summary, 'what' must be a character string or a function

I am trying to following the script/example on ChickWeight plotting raw data in "Independent Group T intervals test", but keeps running into the following error

Computation failed for stat_summary, 'what' must be a character string or a function

I am trying to following the script/example on ChickWeight plotting raw data in "Independent Group T intervals test", but keeps running into the following error

Is it possible to use geom_insert() in ggtree for circular trees?

I am trying to to include my results of ancestral state estimation as pie charts at the nodes of a phylogenetic tree. It works fine for rectangular trees but I

R ggplot date time major and minor axis breaks not aligning

I'm having a problem that I am surprised I haven't encountered before and that I can't see any answers about. I am plotting some date time data in ggplot and wa

Plotting the “Average ” curve of set of curves in ggplot2

My Question is exactly this one: Plotting the "Average " curve of set of curves but I am looking to implement the accepted answer (below) in ggplot. is it pos

Plotting multiple wordcloud (ggwordcloud) with other types of plots in ggplot2

I am trying to plot several wordclouds in a scatterplot and I wonder if one can control the position of a wordcloud in ggplot? As an example the code below over

Is it possible to reorder only the facets of facet_wrap, without reordering the underlying factor levels?

Sample data frame: df <- data.frame(x=rep(1:10,4),y=rnorm(40),Case=rep(c("B","L","BC","R"),each=10)) I can plot each time series in its own facet with: g

How to use a variable to specify column name in ggplot

I have a ggplot command ggplot( rates.by.groups, aes(x=name, y=rate, colour=majr, group=majr) ) inside a function. But I would like to be able to use a param

Decrease the size of a graph in ggplot - R

I have two questions for this graph I did: The first, is how do I decrease the graph size?, I have tried with coord_fixed: ggplot(x, aes(fill=is_pass, y=pe

Is it possible to have one function to download various ggplot plots?

My shiny app generates a number of useful graphs. I would like to allow the user to download the graphs in various formats. I have done this before for a single

ggplot holes in stacked area chart

Here is a link to my data. I use the following code: #read in data data = read.csv("ggplot_data.csv") #order by group then year data = arrange(data, group, y

unable to set xlim and ylim using min() and max() in ggplot

I am missing something crucial here and can't see it. Why does min and max not work to set the axis limits? mtcars %>% select(mpg, cyl, disp, wt) %>

How to plot histogram with 2 variables

I have the following dataset date region Nr_individuals Povertydecile 01-01-2019 1 80 2 01-01-2019