Skip to main content

Questions tagged [ggplot2]

ggplot2 is an enhanced plotting library for R based upon the principles of "The Grammar of Graphics". Use this tag for *on topic* questions that (a) involve `ggplot2` as a critical part of the question &/or expected answer, & (b) are not just about how to use `ggplot2`.

Filter by
Sorted by
Tagged with
0 votes
0 answers
8 views

Geom_smooth of predicted count warnings [closed]

I am currently writing an update of an article on vulture population trends (Vulture article) and looking at regular feeding at four long-term vulture restaurant sites from July 2016 to December 2023. ...
Emeline AUDA's user avatar
0 votes
0 answers
4 views

GLMM with cumulative distances

I have calculated the cumulative distances travelled for each individual. The objective is to represent the data in a graph with a tendency curve using the R package ggplot2. However, the data are too ...
Klervi's user avatar
  • 11
1 vote
1 answer
51 views

Correlation alternatives / How to go about testing this relationship?

I have a large set of temperature data from upstream and downstream gauges. I am trying to find the influence of dam release on downstream temperatures. To do this, I am comparing correlation between ...
Matt Schaaf's user avatar
0 votes
0 answers
27 views

Correlation alternatives / How to go about testing this relationship?

I have a large set of temperature data from upstream and downstream gauges. I am trying to find the influence of dam release on downstream temperatures. To do this, I am comparing correlation between ...
Matt Schaaf's user avatar
3 votes
1 answer
47 views

Extrapolating standard error of logistic regression in R

I'm trying to extrapolate the mean and standard error range of a logistic regression using the predict function in R, splitting the x axis range up into small pieces and predicting the value at each ...
js4032's user avatar
  • 75
0 votes
1 answer
48 views

Manual specification of knots vs bs() for Piecewise regression

I am learning how to specify and plot piecewise regressions and have encountered a confusing situation. Namely, I have specified the knot for a piecewise regression using 2 methods: (1) manual and (2) ...
Yat-Hon's user avatar
  • 13
3 votes
1 answer
43 views

How should I visualise uncertainty in a histogram from survey sampling?

I have a numeric variable $\{x_i\}$, which corresponding weights $\{w_i\}$, where the weights are survey weights from a corresponding complex survey design. I want to visualise a weighted histogram of ...
Alex J's user avatar
  • 2,551
3 votes
1 answer
41 views

Linear Logistic Regression model

I am working on an exercise question, and I am a bit stuck unsure on how to proceed. I was given the data below and asked to graphically display the relationship between dose and kill rate. Using R, ...
Harry Lofi's user avatar
1 vote
0 answers
71 views

How does plotting QQ plot on ggplot work?

I am new to r programming and have ran into an odd situation while plotting a QQ plot for studentised residuals with ggplot2. See code and plot below: ...
Yat-Hon's user avatar
  • 13
3 votes
1 answer
129 views

Finding Cumulative Distribution Function of weighted data

I have census tract data where each row holds the population size and a variable value (e.g., income). I want to plot the cumulative distribution function (CDF) of the TRUE population, i.e., ...
Ilik's user avatar
  • 133
0 votes
0 answers
47 views

Plotting confidence and means from logistic regression in ggplot2

My data are for an experiment asking participants to detect a tone (Response= 1 or 0) in different (within-participant) conditions. I am interested in how participants' scores on separate ...
SilvaC's user avatar
  • 512
0 votes
0 answers
27 views

How to plot/visualize correlation values from two different methods for comparison?

I am working on a project wherein we are comparing two methods used for modeling gene expression: one method is using elastic net and other is using lasso regression. In one method: we see that ...
Rhea Bedi's user avatar
8 votes
2 answers
229 views

Best plot in R for count data with a broad range and lots of low frequency data

I have a data set that looks like this, in reality there are about twenty categories with a count of 1: ...
tacrolimus's user avatar
4 votes
0 answers
64 views

Colorblind aware Red and Blue

When plottling discrete data I tend to use some colorblind palette, even though I am not affected myself. Now I want to plot hearing test data. There is a general (i.e., international) understanding, ...
Bernhard's user avatar
  • 8,485
0 votes
1 answer
56 views

Visualize Cronbach's alpha in R Ggplot scatterplot as a regression line? [closed]

I'm looking for a way to make a scatterplot of the correlation between two questionnaires using Cronbach's alpha: Data: ...
Wandering_geek's user avatar
3 votes
1 answer
75 views

Summary output of binomial GLMM shows significant effects, but graph shows overlapping CI error bars?

I have run this binomial GLMM: ...
NeedHelpWithR's user avatar
1 vote
1 answer
190 views

Is GGeffects what I want to use to plot my linear mixed effect model results

So I am interested in how participants' own preference ratings for a series of items predicts their ratings for a peer's preferences for the same items. My model looks something like below where they ...
Shannon Cahalan's user avatar
1 vote
0 answers
37 views

Plotting custom logistic distribution

I'm trying to understand the logistic distribution and its application in a sports scoring model. The CDF of the logistic distribution is: $F(x) = {1 \over 1 + e^{-(x-\mu) / s}}$ I can then use ...
Daniel Westergren's user avatar
6 votes
1 answer
172 views

mgcv gam P-value vs plotted confidence intervals

I am trying to figure out how to explain the apparent discrepancy between P-values and plotted confidence intervals in mgcv. See for example the plot below that comes from a model that considers the ...
dean's user avatar
  • 455
1 vote
2 answers
44 views

What to plot when main effect significant but interaction insignificant?

This may be a silly question but: Given a regression model that includes both main effects and an interaction term (Score of participants predicted by their attitude and motivation): ...
a.henrietty's user avatar
3 votes
2 answers
76 views

What is the most responsible way to visualise non-response / NA data in a plot?

I'm working on plotting census data, which has a fairly high non-response rate for some questions (5% or higher). This could actually shift the way we interpret the results in quite significant ways (...
Jeremy Kidwell's user avatar
1 vote
1 answer
787 views

Visualising log odds from logistic regression model in R

I'm working on a logistic regression analysis using R and aiming to visualize the effects of the predictor "age" on the binary dependent variable "domestic violence." My dataset ...
user avatar
0 votes
0 answers
50 views

Should I run a linear or binomial regression based on my data distribution?

In the attached image, the x-axis is the proportion of children at a school who passed at least 5 GCSE exams that year, and the y-axis is a count of the schools. The different colours are whether the ...
Jess's user avatar
  • 21
1 vote
1 answer
212 views

How to fix this plot of histogram and pdf in R?

I am studying statistics and am working with R for the first time. I have some data that I am trying to represent it graphically. I have plotted a histogram and am trying to model it with gamma ...
Jesus's user avatar
  • 121
2 votes
1 answer
84 views

Is it appropriate to visualize multiple glm models (of different families) in the same plot?

I am assessing the effect of 5 predictor variables on species abundance. I have created 12 generalized linear models in R that have the same response and five predictors. Rather than run a complex ...
Angie Liotta's user avatar
0 votes
1 answer
65 views

Plot with multiple categorical predictors and before/after comparison

I have a dataset with 5 categorical variables that relate to before/after numerical data. I need to plot the relationship between the categorical data and the numerical results. Each category relates ...
Patricia Nunes's user avatar
1 vote
1 answer
403 views

What do the bars in ggdist::stat_halfeye() mean?

I am trying to understand what the black point, thicker horizontal bar, and thinner horizontal bar mean when I use the stat_halfeye() function. I can't find it on ...
Benji's user avatar
  • 365
1 vote
0 answers
181 views

Interpretation of confidence interval using geom_smooth in ggplot2

I plotted data from two groups using geom_smooth in ggplot2. The default method loess was ...
cliu's user avatar
  • 211
2 votes
1 answer
416 views

GAM - parametric coefficients - what is mgcViz::pterm() actually plotting?

I built a GAM with two categorical variables and two smooth terms, following this structure: ...
mto23's user avatar
  • 637
3 votes
1 answer
542 views

Visualising scatterplot with too many points and two or more groups

I am trying to plot data with a large number of points. The goal is to see the basic distribution - location, dispersion, shape - of the observations. With a simple scatterplot, even with low ...
TY Lim's user avatar
  • 171
1 vote
1 answer
40 views

Holding covariates constant to plot MLR model on 2d scatterplot in R

I am currently working with a MLR model comprising 1 numeric/continuous predictor variable (x1), several nominal categorical variables (x2 ... xi), and an interaction term between the continuous ...
PhelsumaFL's user avatar
0 votes
2 answers
113 views

R conditional mutate within function [closed]

My function plots data and how the data is ordered depends on an argument of the function. The code looks unnecessarily repetitive but I can't figure out how to make the mutate() function (or any ...
achmed's user avatar
  • 35
1 vote
1 answer
278 views

How to interpret the partial effect plots for parametric terms while using gratia::draw() and gratia::parametric_effects()?

I am asking a question akin to this one: https://stackoverflow.com/questions/71884457/what-does-the-y-axis-effect-mean-after-using-gratiadraw-for-a-gam but am wondering the same question for ...
David Smith's user avatar
0 votes
1 answer
31 views

Gaussian Curve equation in R not peaking at zero [closed]

I have been analysing and plotting some different Gaussian curves in R to help me visualise them for a project I am working on. One such expression is the following: In R I have plotted this with by ...
AWGIS's user avatar
  • 83
0 votes
0 answers
38 views

Interpreting cubic splines graph where plot doesn't go to final knot

I have this plot where I found that the best degree of freedom is 8, as it minimizes the SSE when predicted from the training data. However, the graph does not go into the final 8th knot in the spline....
Sam's user avatar
  • 1
5 votes
1 answer
50 views

How to code survival data so that sarting survival is below 1

I am analysing the time to the end of rehabilitation; however, not all patients receive rehabilitation. Therefore, for making Kaplan-Meier curves for the whole study population (including non-...
st4co4's user avatar
  • 2,217
2 votes
1 answer
690 views

Calculating Confidence intervals of marginal means for a linear mixed model using emmeans package

I have built this model in R: ...
Pashtun's user avatar
  • 185
0 votes
0 answers
52 views

How can I draw a interaction plot using trimmed means?

I am conducting two-way ANOVA in r using the t2way function in WRS2 packages for my thesis. t2way function, as you know, uses trimmed mean to escape from the severe problem of heterogeneity of ...
whra's user avatar
  • 1
1 vote
0 answers
43 views

Grouped Boxplots in R [closed]

I want to draw the same exact graph in R. However, I want to consider two options: (1) with one x axis for each of the genders & (2) two different xaxes for each of the gender. Here is also the ...
MK25's user avatar
  • 31
0 votes
1 answer
85 views

Troubleshooting linear mixed effects model plot and trendline slopes

I'm working with multiple years of temperature data from different sites in a watershed. I'm using the 7DADM measurements i.e. one temperature reading for each site per year of monitoring. This is ...
wRigglybean's user avatar
3 votes
4 answers
1k views

Are there any simpler alternatives to boxplots and barplots that can faithfully represent data with outliers and strongly varying ns?

I have a dataset of passwords that looks like this: My goal is to make a graph that accurately showcases the strength of each category so my initial plan was to group the data by category and ...
wageeh's user avatar
  • 241
4 votes
3 answers
181 views

Visualizing Categorical Response Data

I have a dataset that contains the "weight", the "gender" and if someone has "asthma" or not. I am interested in learning about ways to visualize the proportion of people ...
stats_noob's user avatar
1 vote
1 answer
97 views

Why does the confidence boundary contain fewer points than expected in R (`ggplot`)?

I use a LOESS regression and draw a confidence boundary with a 99% level. ...
Julien's user avatar
  • 152
0 votes
0 answers
76 views

What about the tails of a ggplot line graph?

Here is my data with value (numeric), group (A/B), Time (T1,T3), and Condition (neutral/reward) variables. ...
helloiambrain's user avatar
0 votes
0 answers
380 views

In a figure of emmeans, indicate effect size of contrasts as "significance stars"

I have an emmeans object of a logistic regression model (glmer). I made plots with ggplot2, ...
Raoul Van Oosten's user avatar
0 votes
0 answers
51 views

Precipitation to Mean Temperature Relationship

Based on the data below, I am trying to see if there is any relationship between Precipitation and Mean Temperature. Now the <...
Ed_Gravy's user avatar
  • 111
0 votes
1 answer
134 views

Statistical analysis of a bioassay

I am analyzing data on some biossays and I need an advice on which statistical analysis to use and how to use ggplot2 R package to better visualize the results. As you can see in the above image I ...
user avatar
23 votes
5 answers
6k views

How should we do boxplots with small samples?

This question is inspired by this posting, plus a comment by @StephanKolassa and an answer by @dipetkov who point out that the boxplots presented in that question are misleading. As is pointed out, ...
Russ Lenth's user avatar
  • 20.7k
0 votes
1 answer
682 views

Add straight-line in ggplot with date on the x-axis [closed]

I have below ggplot. ...
Bogaso's user avatar
  • 871
1 vote
0 answers
110 views

Finding statistical significance difference using Z score test using r

I wonder how to perform the z proportion test to check which COG category of Shewanella_sp_Alg231_23 is significantly high p (<0.05) from other genomes. To undersatnd I have attached a bar braph. <...
umar's user avatar
  • 111

1
2 3 4 5 6