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
4 views

How to plot identical slopes for an ANCOVA (1 categorical variable(2 levels) with 2 covariates) using ggplot2

I am trying to compare and plot regression lines of an ANCOVA when their slopes are the same and no interaction effect There are two sets of ANCOVAs plots that I am trying to create: a) 1 ...
0
votes
0answers
15 views

add legend to ggplot geom points [on hold]

I've created a ggplot indicating 3 different activities for male bats in three different colours: ...
0
votes
0answers
11 views

What is the difference between the “+” operator in ggplot2 and the “%>%” operator in magrittr? [migrated]

What is the difference between the "+" operator in ggplot2 and the "%>%" operator in magrittr? I was told that they are the same, however if we consider the following script. ...
0
votes
0answers
11 views

Creating a Bargraph with Error Bars [closed]

I am novice programmer and am making an attempt to learn R. Below is the dataset I am working with: ...
2
votes
0answers
58 views

Scatter plot with two factor variables for black and white print

How can I best represent a scatter plot with two different factor variables. Consider the example problem, ...
1
vote
0answers
24 views

R: how to plot a cox regression model survival curves (treated vs control curves) using ggplot2? [migrated]

I have a cox model in R that shows time to diabetes. The formula is: ...
0
votes
0answers
3 views

Regression line in ggplot doesn't match computed regression [migrated]

Im using R and created a chart using ggplot2. ggplot(Month.Data, aes(y=Measure, x=Samples)) +geom_point() + geom_smooth(method = "lm", se = FALSE) I then create ...
0
votes
0answers
16 views

Plotting a box plot with subcategories in R [migrated]

I would like to plot a box plot with subcategories using ggplot2. For example, p <- ggplot(mtcars, aes(factor(cyl), mpg)) p + geom_boxplot() gives me 3 ...
0
votes
0answers
33 views

Decision Boundary for KNN Classifier for a dataset having 3 classes in R

How do I go about plotting the decision boundary for a dataset that has three class. I have used KNN classification to classify the data set. I am using R as my desired programming language.
3
votes
1answer
95 views

How to draw fitted graph and actual graph of gamma distribution in one plot?

Load the package needed. library(ggplot2) library(MASS) Generate 10,000 numbers fitted to gamma distribution. ...
0
votes
0answers
24 views

Plotting data from a mixed repeated-measures design: Normed means necessary?

I want to plot data from a 2 X 2 mixed repeated measures design (one within-subjects factor, one between-subjects factor) using ggplot2. On ...
0
votes
1answer
21 views

problem with stacked bargraph in ggplot [closed]

Can someone help me to add labels in the middle of each piece. ...
2
votes
3answers
150 views

Alternative visualizations to 3D bar chart

I have a dataset that consists of a numerical variable (height, y-axis). Each data point is replicated for an individual (1,2,3) in each treatment (A,B,C,D). Here is a terrible figure that I am ...
3
votes
2answers
126 views

Trying to create an impossible graph?

I want to create a graph, but I'm not sure if it even exists because I couldn't find any example that makes use of it. To illustrate the problem, I'll make some data up. Let's say I want to represent ...
0
votes
1answer
59 views

ggplot and loops [closed]

I have a data file with a lot of different variables. I can plot every variable independently this way: ...
0
votes
1answer
58 views

Is bar plot the right choice for my data?

(I asked this question before, here) I have the following data frame (dcity): City Income_Group Number_of_Neigbourhoods Metropolis High 7 Metropolis Mid ...
1
vote
1answer
85 views

LOESS for subset of data

I want to analyze the performance of two classifiers. For that I have a dataset with 30000 observations that each have an independent variable interactions and a ...
0
votes
0answers
31 views

Best way of represent data where there are several images per X

I have a dataset where one column is the delay of a request and the other the timestamp of such request. The issue is, that since the application is multithreaded, there are several reported delays ...
1
vote
1answer
125 views

Best way to visualize data with two keys and many rows in R (heatmap, mosaic plot, treemap, ggplot)

I have been wrestling with the problem of creating some type of visualization for my data. I have two keys (used in data table to create the data) that are intervals. I constructed the intervals ...
2
votes
2answers
853 views

R: geom_density values in y-axis [duplicate]

Why geom_density is showing me values higher than 1 in the density plot? How to change it into fraction? And my code used to generate the plot ...
1
vote
1answer
409 views

Plot the confidence interval of bootstrapping in ggplot2 [closed]

I have a dataframe df (see below): ...
1
vote
1answer
72 views

Plot bootstrapping in ggplot2 [closed]

I have a dataframe df (see below): ...
0
votes
1answer
133 views

anova test comparing two different linear models

I want to compare these two linear models by anova: ...
0
votes
0answers
22 views

Summary and stat for two different linear models [duplicate]

I do a linear models according to group (A and B), I want to extrapolate the two lm something like summary(lmA) summary(lmB). Also I want to test whether there is a statistical difference between ...
1
vote
0answers
25 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
39 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
319 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
43 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
51 views

Plotting cumulative average means in ggplot2 [closed]

I want to depict the result of several replications (mean, confidence interval) ...
0
votes
0answers
101 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
200 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 ...
7
votes
1answer
501 views

Visualizing PCA in R: data points, eigenvectors, projections, confidence ellipse

I have a dataset of 17 people, ranking 77 statements. I want to extract principal components on a transposed correlation matrix of correlations between people (as variables) across statements (as ...
0
votes
1answer
109 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
796 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
34 views

Compute confidence cutoff for scatterplot

I have data collected from two different individuals for different treatments, like this: ...
3
votes
2answers
72 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
982 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. ...
1
vote
2answers
485 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
1k 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
72 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
104 views

Curve fitting in R. L-shaped?

I have measurements for my dependent and independent variable across 4 different experimental sites ...
0
votes
0answers
19 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
242 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
124 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
247 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
133 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
6k 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
1answer
939 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
1answer
174 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 ...