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

How to plot a vglm/propodds regression in R

Hi I'd like some help plotting the following regression in "r": fit1_usesrp <-vglm(rp ~ is.native + is.male + oh + cjs + age2 + tw ,propodds, data = dummydata ...
0
votes
0answers
3 views

Adding a legend to a ggplot2 geom_tile plot based on size [migrated]

I am creating fluctuation diagrams in ggplot2 using geom_tile, and would like to add a legend for size. I am at a loss as to how to do so. Here is a MWE: ...
0
votes
0answers
7 views

XGBoost on Python: Plot performance

following the instructions from https://xgboost.readthedocs.io/en/latest/python/python_intro.html after building my model, i tried on Jupyter (using Mac OS X, Chrome browser) ...
0
votes
0answers
3 views

shapes coming out filled and not hollow when using ggplot R [migrated]

I have a problem I am using ggplot to make 3 scatter plots acording to 3 diffrnet factors in my data(years 1997,2002,2007) this is the code ...
0
votes
0answers
11 views

How to plot a second legend in ggplot2 in r [migrated]

I have two datasets I am trying to display on one chart overlaid in ggplot2 under r. Dataset 1 needs to be displayed as a grouped set of bars (1 group per country - there are a few countries in the ...
0
votes
0answers
13 views

Plotting Negative Binomial curves in GGplot

I am trying to plot this data with a negative binomial curve and I keep coming up with this warning label. Now, I know what the theta is, but I can not figure out where in the code to specify it. ...
5
votes
3answers
124 views

A bar graph and its look - should I add titles, where should values go etc

I didn't use r but I have recently decided to use it to plot graphs because of its great capability to do so. 'd like to plot a graph that shows voter turnout in ...
1
vote
0answers
26 views

How to plot a categorical variable from a GLM

How do you correctly plot results from a GLM used to test a categorical variable? Here is a reproducible example in R: ...
1
vote
1answer
52 views

How to set the prediction range of ARIMA model in R

I am new to R and statistics. I have a problem related to the prediction: I am not able to plot the real value together with the predicted value. PROBLEM: I want to feed first 16 values into the ...
0
votes
0answers
12 views

DoE and Parallel Coordinate Plot

First off, I'm not too technical; however, I know what I need to do more or less, but don't know how to put the pieces together. I need to create a Design of Experiments, perhaps with R Studio. With ...
0
votes
0answers
23 views

R LOESS losing precision along the way

I am trying to draw a smoothing line on a frequency graph with ggplot2. My data are represented like this: ...
1
vote
0answers
13 views

ggplot2: lines for continous X but not for factor X [closed]

I have data like this: |Age | y1 |y2 | |----|--------|--------| |2.3 |41.65385|24.67692| |2.4 |48.58085|37.10851| |3.1 |49.93944|41.19296| |2.2 |55.19765|50.71176| |... |... |... | ...
0
votes
0answers
29 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 ...
2
votes
0answers
94 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, ...
0
votes
0answers
56 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
344 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
31 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
28 views

problem with stacked bargraph in ggplot [closed]

Can someone help me to add labels in the middle of each piece. ...
2
votes
3answers
290 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
135 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
270 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
63 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
136 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
39 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
177 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
2k 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
774 views

Plot the confidence interval of bootstrapping in ggplot2 [closed]

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

Plot bootstrapping in ggplot2 [closed]

I have a dataframe df (see below): ...
0
votes
1answer
259 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
30 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
402 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
59 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
63 views

Plotting cumulative average means in ggplot2 [closed]

I want to depict the result of several replications (mean, confidence interval) ...
0
votes
0answers
115 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
269 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
640 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
130 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
1k 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 ...
3
votes
2answers
82 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
2k 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
711 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
2k 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
80 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
121 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
306 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
148 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
304 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 ...