Top "Ggplot2" questions

ggplot2 is an actively maintained open-source chart-drawing package for R, written by Hadley Wickham, based upon the principles of "Grammar of Graphics". It partially replaces R's basic plot and the lattice package, while providing a clean, powerful, orthogonal and fun API.

Add legend to ggplot2 line plot

I have a question about legends in ggplot2. I managed to plot three lines in the same graph and want …

r ggplot2 legend r-faq
Increase number of axis ticks

I'm generating plots for some data, but the number of ticks is too small, I need more precision on the …

r ggplot2
How to change facet labels?

I have used the following ggplot command: ggplot(survey, aes(x = age)) + stat_bin(aes(n = nrow(h3), y = ..count.. / …

r ggplot2 symbols facet plotmath
Order discrete x scale by frequency/value

I am making a dodged bar chart using ggplot with discrete x scale, the x axis are now arranged in …

r ggplot2 r-faq
adding x and y axis labels in ggplot2

How do I change the x and y labels on this graph please? library(Sleuth2) library(ggplot2) discharge<-ex1221…

r label ggplot2
Change bar plot colour in geom_bar with ggplot2 in r

I have the following in order to bar plot the data frame. c1 <- c(10, 20, 40) c2 <- c(3, 5, 7) …

r ggplot2 colors geom-bar
What does the error "arguments imply differing number of rows: x, y" mean?

I'm trying to create a plot from elements of csv file which looks like this: h1,h2,h3,h4 a,1,0,1,0 …

r csv matrix plot ggplot2
ggplot2 line chart gives "geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?"

With this data frame ("df"): year pollution 1 1999 346.82000 2 2002 134.30882 3 2005 130.43038 4 2008 88.27546 I try to create a line chart like this: plot5 <- ggplot(…

r ggplot2
Show percent % instead of counts in charts of categorical variables

I'm plotting a categorical variable and instead of showing the counts for each category value. I'm looking for a way …

r ggplot2
R ggplot2: stat_count() must not be used with a y aesthetic error in Bar graph

I am getting this error while plotting a bar graph and I am not able to get rid of it, …

r ggplot2 bar-chart