GGplot2 is an actively maintained open-source chart-drawing library 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.

learn more… | top users | synonyms

0
votes
0answers
6 views

Control color transperancy in GGPLOT2 [migrated]

I want to control the transparency of manually specified colors using a column 'x' with values 1 to 10. I can do so by adding 'alpha = x' but in that case I see dark color dots in my scatter plot. Can ...
1
vote
2answers
27 views

T test with one group

I think it is a simple question, but I got many different results and now I am not sure which test to use. I have one group and 2 different scores (higher scores means higher either positive or ...
5
votes
0answers
100 views

Demonstrate difference in growth over time

Short version Is there a difference per treatment given time and this dataset? Or if the difference we're trying to demonstrate is important, what's the best method we have for teasing this out? ...
2
votes
1answer
130 views

R ggplot2/ezPlot: Plotting 3x3 RM ANOVA design per quantile of covariate with error bars

First of all, my data: http://www.pastebin.ca/2599202 (I hope this is not too inconvenient, because I fail creating good fitting example data) What I basically need, is a plot like: I plotted the ...
0
votes
0answers
42 views

comparing results of lmer using geom_area plots

I was wondering if somebody could help with trying to visualise some data. I have 11 groups of organisms and have related them to levels of a specific bacteria in water samples. I have a strong ...
1
vote
1answer
90 views

Learning curve shows decreasing accuracy

I'm working on a random forest classifier with 10-folds CV to aestimate the hyperparameter 'mtry' (chosen by maximizing AUROC). I decided to pre-split the training set in 8 samples equals in size ...
0
votes
1answer
366 views

Risk table for a Kaplan Meier plot in R

I need to make a Kaplan Meier plot with a risk table beneath it. Otherwise stated, I need a table of the number of subjects at risk at different time points aligned below the figure. I found a website ...
2
votes
1answer
94 views

Plot 3 density plots in the same graph, showing also standard deviation limits in each one

I have obtained from a paper next results: Variable 1: Mean=165, sd=15 Variable 2: Mean=149, sd=18 Variable 3: Mean=134, sd=25 I have simulated normal distributions using rnorm. This is the way ...
1
vote
2answers
47 views

Plotting data from several files on one plot

I have more than one file of data from different experiments. For the sake of the argument here, let's say I have three files E1.txt, ...
0
votes
2answers
70 views

How to retrieve adjusted values for a predictor variable in a linear model in R

Using R and ggplot, I would like to plot my output variable with one of my predictor variables adjusted for the other variables in the model. (I'm asking this question here, because I don't actually ...
1
vote
0answers
25 views

Creating a ‘bounding polygon’ for a set of points (preferably with GGplot2) [duplicate]

In R, Lets say that I have a set of x and y points, how can I get a geom_polygon to encapsulate all points, ie, what is the best way to create a 'bounding' polygon ...
3
votes
2answers
128 views

Comparing weights versus time graphically using reshape, vioplot, and ggplot2

I have a group of 200 children who came to clinic at months 0, 1, 2, 3, 6, 9, and 12 this year. At each clinic visit the children were weighed. ...
1
vote
0answers
209 views

Creating summary tables / graphics in R for categorical data [closed]

I am trying to summarise data from a household survey and as such most of my data is categorical (factor) data. I was looking to summarise it with plots of frequencies of responses to certain ...
1
vote
0answers
67 views

How build smoothed curve of incidence rates using subject data?

I have a dataset with subjects (data0). Each subject has a follow up time (fuy), an indicator for incidence (ind = 0/1) and a variable which indicates, for example, year of diagnosis (year). One way ...
6
votes
4answers
527 views

Boxplot equivalent for heavy-tailed distributions?

For approximately normally distributed data, boxplots are a great way to quickly visualize the median and spread of the data, as well as the presence of any outliers. However for more heavy-tailed ...
1
vote
1answer
86 views

Plotting the gap between two times

I have a (large) dataset where I know, for each observation, the departure and the arrival time of a worker (between 0 and 24, in decimal) : ...
0
votes
1answer
444 views

US heatmap using zipcodes

We are attempting to create a US heatmap using only zipcode and corresponding values using R. While there are a number of examples that use lat and long data for creating such maps, is there one that ...
1
vote
0answers
96 views

Is LOESS the appropriate way of visualizing my RT data?

I am conducting a Lexical Decision Task where my dependent random variable is Response Time (RT). My experimental design consists of 5 blocks of a 100 trials each. In each block, 50% of trials ...
3
votes
1answer
151 views

Graphical representation of cross-validation errors for regression

What are some good ways of presenting/comparing cross-validated RMSE errors for regression using various models, graphically via plots? As of now, I have been presenting the quantitative results in ...
7
votes
1answer
1k views

How does ggplot compute confidence intervals for regressions?

The R plotting package ggplot2 has an awesome function called stat_smooth for plotting a regression line (or curve) with the associated confidence band. However I am having a hard time figuring out ...
2
votes
2answers
271 views

Plotting a model in R

I have used the vglm() function from the VGAM package to obtain a Weibull model for some data. I would like to plot the curve that this model is represented by. How do I do this? Here's my input and ...
5
votes
1answer
757 views

How do I create and interpret an interaction plot in ggplot2?

I am trying to make an interaction plot for this set of data, but I want to make it with ggplot2. I am trying to predict VP using the predictors G and P, (these are columns in the dataset which I have ...
1
vote
3answers
735 views

How to compare dependent variables with different units using Grammar of Graphics paradigm?

My data analysis workflow is through R and ggplot2, in part because ggplot2 discourages me from making 'bad' (misleading, etc.) ...
10
votes
1answer
1k views

Getting different results when plotting 95% CI ellipses with ggplot or the ellipse package

I want to visualize the results of a clustering (produced with protoclust{protoclust}) by creating scater plots for each pair of variables used for classifying my ...
4
votes
1answer
392 views

Visualization of binned frequency distribution in R

I am trying to visually represent the distribution of last names in the US. Specifically, I am trying to show that the distribution is such that the most common names (say the top 50) are very common ...
6
votes
2answers
1k views

How to predict or extend regression lines in ggplot2?

I have a data frame that contains two time series: the dates and version numbers of Emacs and Firefox releases. Using one ggplot2 command it's easy to make a chart that uses loess (in a way that looks ...
5
votes
2answers
219 views

Temporal trend visualizations for regions

I try to reproduce a plot which I found in a publication (Mayor-Fernández et al 2012) showing unemployment rates across time for several regions. It combines a heatmap (?), a time series plot (lower ...
6
votes
0answers
313 views

Modeling a spline over time — design matrix and survey of approaches

A response variable y is a nonlinear function of a number of predictor variables X (in my real data the response is binomially distributed, but here I'm using a normally-distributed value for ...
2
votes
2answers
3k views

Plot a subset of categories on the x-axis in ggplot

everyone! I'm trying to plot pvalues of a test by categories (in this case, genetic loci). So, the x-axis contains gene names. I'm getting the plot to work, but the x-axis was very busy, so I am ...
17
votes
6answers
6k views

How to determine best cutoff point and its confidence interval using ROC curve in R?

I have the data of a test that could be used to distinguish normal and tumor cells. According to ROC curve it looks good for this purpose (area under curve is 0.9): My questions are: How to ...
5
votes
1answer
718 views

How to visualize both total counts of categories and proportions of subcategories in a plot?

Suppose I have samples drawn from categories A, B, C. Within those categories, I have subcategories d,e,f which are found in all 3 categories. I want to visualize how many samples I have form ...
13
votes
2answers
1k views

Are gridlines and grey backgrounds chartjunk and should they be used only on an exception basis?

It seems that most authorities agree that dark or otherwise prominent gridlines in plots are "chartjunk" by any reasonable definition and distract the viewer from the message in the main body of the ...
1
vote
1answer
933 views

Dropping unused levels in facets with ggplot2

Is it possible to drop levels that are not used in ggplot2s facets? This is my code: ...
1
vote
0answers
41 views

How to use ggplot to do the binned quantile plots(one type of scatter plot)? [duplicate]

Possible Duplicate: How to do a pretty scatter plot in R? How to use ggplot to do the binned quantile plots(one type of scatter plot)? Hi all, I have done scatter plot: plot(x, y). Now I ...
16
votes
2answers
3k views

How to draw neat polygons around scatterplot regions in ggplot2

How do I add a neat polygon around a group of points on a scatterplot? I am using ggplot2 but am disappointed with the results of geom_polygon. The dataset is over ...
1
vote
1answer
478 views

Problem printing greyscale or B&W ggplot2 images

I have an issue with printing/creating black and white and greyscale images with ggplot2. I have been trying to make some black and white, and greyscale graphics for publication, they look perfect on ...
7
votes
1answer
1k views

Dirichlet distribution plot in R

I want to plot $15$ random draws of Dirichlet distribution with $\alpha = 1$ and dimension $n=10$ in R. ...
2
votes
1answer
2k views

How to plot a stair steps function with ggplot?

I have the graph like this: R code for generating it is: ...
3
votes
3answers
849 views

How to plot a learning curve based on a sequence of date stamped successes and failures?

I have data on results of surgical operations: date of operation (in YYYY-MM-DD format) result of operation (0 for successful operation, 1 for unsuccessful operation) Date is usually used only ...
1
vote
2answers
256 views

Grouping a “other” group with R and ggplot2

I'm trying to figure out, how to best deal with an "other" group or how to create one. I'm using R and ggplot2. Data As an example: I'm analyzing the german Bundestagswahl (general election, every ...
3
votes
1answer
3k views

Calculating standard error and attaching an error bar on ggplot2 bar chart

Given a minimal dataset where am looking for the occurrence of a certain motif within a dataset of 500 observations. with_motif represents obervations with the specified motif and without_motif are ...
3
votes
1answer
3k views

How to specify labels per facet in ggplot2?

I am using ggplot and I would like to label the scales in each facet of a plot manually. The concept is discussed here: http://groups.google.com/group/ggplot2/browse_thread/thread/d2044ed0f91de98a ...
4
votes
1answer
798 views

What does this blur around the line mean in this graph?

I was playing around with ggplot2 using the following commands to fit a line to my data: ...
6
votes
3answers
3k views

How to compare two datasets with Q-Q plot using ggplot2?

As both a stats and R novice, I have been having a really difficult time trying to generate qqplots with an aspect ratio of 1:1. ggplot2 seems to offer far more control over plotting than the default ...
5
votes
1answer
125 views

Why is the tick marker for zero after the bar in this qplot bar chart?

Feature or bug? Why is it that the tick marker for zero projects is after the bar that represents the count for zero in this plot (instead of being in the middle as I'd have expected): ...
1
vote
1answer
637 views

Why is the y-axis in this R plot showing invalid percentage values?

Why are the percentages in the y-axis of this bar chart displayed incorrectly (values larger than 100%) and how can I fix it? ...
0
votes
1answer
307 views

How to add a label to the max value in R's ggplot2?

how can I add a label to the max value of this plot: qplot(c, data=subset(df,c < 3000),geom="freqpoly") c is just integers
3
votes
2answers
442 views

Plotting changes in a three-valued ordinal variable across two time points using R

I have a dataset with 4025 participants across two time points. I have scored them on a three-point categorical variable (Unlikely, Possible, Probable) at each time ...
10
votes
1answer
10k views

Boxplot with respect to two factors using ggplot2 in R

I am very new to R and to any packages in R. I looked at the ggplot2 documentation but could not find this. I want a box plot of variable boxthis with respect to ...
2
votes
1answer
907 views

How to add standard error to plots in ggplot2 with R?

I'm in the process of learning R, in the hope of replacing everything I do in SPSS/Sigmplot with R. It's going well so far :) I've got to the point of running a repeated-measures ANOVA, but have come ...