ggplot2 is an actively maintained open-source chart-drawing library for R, written by Hadley Wickham, based upon the principles of "The 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 (1)

0
votes
0answers
18 views

R ggplot2: overlaying multiple geom_ribbon objects in a single plot using a nested loop [migrated]

I have five line plots from which I'd like to output a shaded area that represents the region between their plotted upper and lower regions. I'm creating an R script (see below) as I have multiple ...
0
votes
0answers
18 views

Efficient way to summarise, re-group and plot data set of group frequencies in R [migrated]

I have a set of data for three groups (A, B, C) which gives information on how often a certain value "x" (between -3 and +3) is observed for that group (0 to 100). To give a simplified example: ...
0
votes
0answers
9 views

Add plot legend in ggplot2 [migrated]

How can I add a legend to my plot with this dataset? I would like to plot all variables in the same plot and identify the lines by names. ...
1
vote
0answers
19 views

Visually Compare Different Sampling Methods [closed]

I am working on a project exploring results from a dataset, when using different sampling designs on that dataset. It is really fun thus far, and I have been learning a great deal of things especially ...
0
votes
0answers
36 views

How to create a Kaplan-Meier plot using ggplot2 with the number at risk table beneath [duplicate]

I want to create a Kaplan-Meier plot using ggplot2 with a number at risk table beneath. The number at risk table should be aligned to the x-axis ticks of the Kaplan-Meier plot. Here I found how to ...
3
votes
1answer
146 views

Plotting Clusters over a ggplot graph in R

I am working with GPS data for density based clustering in R. Let's suppose, I have produced a path out of the following dataset. Now, where the density of plot is high enough (as shown in graph) ...
0
votes
1answer
21 views

How to add overall data to group by category chart in R? [closed]

i have a (ggplot) chart whit multiple data grouped by factor column. I also would like to add an "overall" group to it. Is there an easy way to do this? For example i want to extend this plot with a ...
1
vote
0answers
26 views

Plotting cumulative average means in ggplot2 [closed]

I want to depict the result of several replications (mean, confidence interval) ...
0
votes
0answers
75 views

comparing weight, height and age differences for different countries

I have a large dataset with athlete data from various countries. what is the most effective way to graphically show weight, height and age differences for the different countries using ggplot in R? I ...
0
votes
1answer
85 views

ggplot2 - geom_density(): how to change legend title and order [closed]

i created a density diagram for a set of data, divided by the different weekdays. ggplot(template, aes(x=test, color=as.factor(Weekday))) + geom_density() Now i ...
5
votes
0answers
175 views

What's wrong with this visualization of eigenvalues/vectors/PCA?

I have a dataset of 17 people, ranking 77 statements. I want to extract principal components on a rotated correlation matrix of correlations between people (as variables) across statements (as ...
0
votes
1answer
57 views

What measures the y-axis in stat_smooth, ggplot2 in R? [closed]

I am fairly new with logistic regression. I have a binary response. And did this plot. The binary response is: Y = 0: The student fails Y = 1: The student succeed ...
3
votes
1answer
184 views

How to interpret notched box plots

While doing some EDA I decided to use a box plot to illustrate the difference between two levels of a factor. The way ggplot rendered the box plot was satisfactory, but slightly simplistic (first ...
0
votes
0answers
22 views

Compute confidence cutoff for scatterplot

I have data collected from two different individuals for different treatments, like this: ...
3
votes
2answers
62 views

Comparing Categorical Variables

What is your go to method to visualize relationships between categorical variables? At work, I find myself working with a discrete outcome variables quite a bit. When exploring data, I often want to ...
0
votes
1answer
215 views

What does Density mean on Y-axis in qplot()? [duplicate]

I'm a beginner at R. I was trying out some code for implementing a basic qplot() on the inbuilt 'mtcars' dataset in R. ...
0
votes
2answers
204 views

The meaning of units on the axes of a PCA plot

I've used the R packages DESeq2 and ggplot2 and the following code ...
1
vote
1answer
746 views

Plotting a polynomial regression with its confidence interval of 95% in R

I have been trying for a while plotting a polynomial regression using R. I have read several libraries, as ggplot2, qplot, etc, with no succeed. The next are my data: I normally use the R GUI called ...
1
vote
0answers
62 views

Subject-specific graphics for repeated-measure design

I am doing linear mixed effect modelling testing the effect of treatment on pitch, with ...
0
votes
0answers
73 views

Curve fitting in R. L-shaped?

I have measurements for my dependent and independent variable across 4 different experimental sites ...
0
votes
0answers
18 views

R: Fit a trendline to these points in ggplot [duplicate]

I have measurements for my dependent and independent variable across 4 different experimental sites ...
2
votes
0answers
126 views

Describing GAM from ggplot's stat_smooth in a paper

I am writing a paper where I have some figures with lines drawn using ggplot2's stat_smooth with no arguments. When I generate a ...
-1
votes
1answer
91 views

Rearrange boxplot with ggplot [closed]

My data looks as follows: X=cbind(var1=rbinom(100,1,0.26),var2=rbinom(100,1,0.01), var3=rbinom(100,1,0.07),var4=rbinom(100,1,0.09),var5=rbinom(100,1,0.004)) If ...
0
votes
2answers
177 views

Density plot narrow peaks and mean far away from peaks

I am trying to understand a density plot. It has narrow peaks and means are far away from the peaks. What would be the reason for such behavior? Should I be doing a different plot to understand this ...
1
vote
2answers
96 views

Density Plot, scatter plot or Regression if not both best way to visualize

I am working with a data set that has information of users and their contributions. Each user has expert level and contribute to multiple section of the project. Here is a sample data set: ...
1
vote
2answers
4k views

Best approach in R for interpolating and curve fitting a tiny dataset?

I have a set of 'activity' values for some enzyme assays I have been doing, that come out of some analysis I've been doing. The problem is, the data is fairly crap, and there aren't many points, but ...
0
votes
0answers
22 views

Using density estimate to look for problems in data collection - with R

I am analysing some data coming from different media (tv, press, ...). I would like to test if the data I have are good (if the collect was flawless), identify big issues and eventually understand ...
0
votes
1answer
631 views

Scatter plots in ggplot2 with non linear trend line [closed]

I'm trying to create a scatter plot using ggplot. The x value goes roughly from 0-20, and the y value goes from 0-~50. The data is raw so it's not nice and neat and I need to plot a curved line ...
0
votes
0answers
32 views

Terminology and handling of log-normal mixture distributions

The definition of a log-normal distribution of a random variable is based on normality of its logarithm. I'm curious whether there exist a specific term for cases, where log-transformed data does not ...
0
votes
1answer
144 views

Compare regression slopes of repeated measures linear regression

In my design, I have two groups of subjects and every subject is tested in four different conditions. So, I have a within-subject factor ('span_num', which ranges from 0 to 3) and a between-subject ...
2
votes
1answer
3k views

Smoother lines for ggplot2

This question probably has a simple solution, still the thing is I've written a code to plot mortality in 2 different groups and that is, death in obese patients vs not obese. Now their are 2 groups ...
2
votes
1answer
259 views

How to plot a comparison of read counts in R

I have a bunch of genetic read counts for different several genes. Each gene is divided into two groups (0 and 1). What I want to do is make a vertical plot side by side of the 0 group and the 1 ...
2
votes
1answer
926 views

R scatterplot matrix with nonparametric density

I normally use MATLAB, or JMP but right now am working with R. I have ~150 dimensional data with a few hundred thousand rows. Some of the columns are non-informative, they only have one value. This ...
2
votes
0answers
135 views

Contradicting interaction significance with graphical visualisation in glmer

I'm investigating environmental effects (wind) on acoustic receiver detection probability for two types of transmitters using a binomial glmer. While my model analysis indicates that there's a ...
3
votes
1answer
4k views

How can I 'dodge' the position of geom_point in ggplot2?

I am using ggplot2 in R to make plots like the following ones: The errorbars overlap with each other which look really messy. How can I separate the errorbars for different indices? I have used ...
0
votes
0answers
2k views

Q: plot glmm fixed and random effects (glmer in package lme4) using ggplot2

I am trying to visualize the results from a glmm that I ran with the lme4 package. ...
2
votes
2answers
294 views

How can I cluster data in a grid-like fashion and heat map the averages in R?

I have a data frame of 3 columns. The first one is the response variable the second and the third ones are some criteria. You can create your own example similar to mine, using this piece of code with ...
1
vote
2answers
99 views

What is the best way to automatically select sensible, comprehensible breakpoints?

ggplot2 seems to, by default, select very nice, comprehensible breaks for continuous data. I would like to plot the data according to one scale (logistic) by ...
5
votes
1answer
56 views

Parameter region for existence of solutions of equation

How does one plot the set S of parameter region of equations using r?. My problem is that I have one equation with 2 variables defined by $g(x,a,b) = 0$ and I want to plot the set of $(a,b)$ where the ...
0
votes
1answer
187 views

Can I Use a Dummy Variable in Quadratic form in lm() in R?

I'm trying to replicate models published in The Age-Productivity Gradient: Evidence from a Sample of F1 Drivers and am stumbling at first hurdle over a line "the baseline specification contains a ...
1
vote
2answers
35 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
1answer
194 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
540 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 ...
1
vote
1answer
438 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
3k views

Risk table for a Kaplan Meier plot in R

I need to make a Kaplan Meier plot with an at-risk or risk-set table beneath it. Otherwise stated, I need a table of the number of subjects at risk at different time points aligned below the figure. ...
2
votes
1answer
326 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 ...
0
votes
1answer
2k views

In R, how do I fit a student-t distribution to a set of empirical data? [duplicate]

In R, I can fit a Probability Density Function to some empirical data using the following code: ...
1
vote
2answers
55 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
148 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
26 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 ...