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
2 votes
1 answer
43 views

What is the best way to visualise a panel regression?

Simple scatter plots or a correlation matrix can be misleading since they aggregate all years together. What would be te best way to visualise relationships between variables taking time into account? ...
user avatar
0 votes
0 answers
10 views

Super Scripts on Axis Values ggplot

I have a forest plot where I am trying to have superscripts on my y-axis values. Thus, I want the 1's and the 2 to be superscripts to their respective labels. Your help would be greatly appreciated. ...
user avatar
0 votes
0 answers
19 views

How can a three-way interaction between three categorical DVs and a categorical IV be visualised?

I have a dataset which contains a two-level categorical dependent variable and three two-level categorical independent variables. A logistic regression showed a significant three-way interaction ...
user avatar
2 votes
1 answer
38 views

What do ggplot's stat_summary errorbars mean?

Say we have the following data: ...
user avatar
  • 23
0 votes
0 answers
21 views

Plot the effect of one continuous variable on the change of another continuous variable through time

I have the change of empathy (continuous variable) from time 0 to time 1 and I want to see how another continuous variable (immersion) is affecting the change of empathy. I am using R and ggplot.
user avatar
1 vote
1 answer
42 views

Why do my model visualization and model estimates not match (R, ggplot)?

I am studying the relationship between government fiscal balances (BAL) and bond yields (LTINT). I have a simple regression discontinuity model with a numerical variable (BAL), a dummy (SGP: breach/...
user avatar
0 votes
0 answers
19 views

Which one is intercept in linear mixed-effects model?

I have a repeated measures of depression as a dependent variable. I could not solve which one is intercept here. I was checking the graph but none of them reflects to the intercept. https://ibb.co/...
user avatar
1 vote
0 answers
48 views

Plot multiple lines in transparent gray such that overlapping parts are darker [closed]

Unfortunately I cannot remember where I saw it, so I cannot provide a picture of how the plot should look like. I can just describe it: Do you know a way in MATLAB or R to plot multiple time series in ...
user avatar
  • 762
1 vote
1 answer
212 views

R: Plotting lmer confidence intervals per faceted group

I am using lme4 package to run a Mixed-Effects Model followed by the predict function ot obtain fitting lines per invidual level and group level. Yet, I am ...
user avatar
2 votes
1 answer
26 views

Aren't these both plots of the residuals? If so, then what is the difference?

I'm analysing the Boston dataset from the MASS package in R. I begin by carrying out a linear regression with medv as the ...
user avatar
  • 1,096
1 vote
0 answers
265 views

Poisson regression with offset - help with fit and visualization

My goal is to understand the relationship between the number of worms found in a plot of land and the percent silt that makes up the soil. The plots of land have been investigated to different extents ...
user avatar
0 votes
0 answers
66 views

How to plot dichotomous presence/absence data to complement timeseries data

I have a daily logger data for several variables. For this example I use 3 variables: precipitation, distance and I dichotomous variable (1/0) which is 1 if the precipitation is in the form of rain ...
user avatar
0 votes
1 answer
71 views

R prediction interval - two different methods get two different values

Does anyone know what I'm doing wrong here? I'm trying to get a prediction interval for a linear model using the mtcars dataset. I try two different methods and get two different answers. I'm all ...
user avatar
  • 79
1 vote
0 answers
141 views

The ggpredict function returns incomplete confidence intervals for a linear mixed midel with an interaction

I am trying to create a plot showing the LMM prediction with confidence intervals using the ggpredict function from the ggeffect ...
user avatar
0 votes
0 answers
86 views

Calculating number at risk for Kaplan Meier analysis with staggered entry

I am trying to create KM curves in r on data from a telemetry project. The data is right censored and additionally not all individuals were tagged on the same day so they entered the study at ...
user avatar
1 vote
1 answer
45 views

Side by side bar charts using ggplot2 [closed]

I am a current undergraduate student working on my first small research project. I am trying to make 3 barcharts of percentages of experiencing racism side by side and I am having trouble with this. I ...
user avatar
  • 11
3 votes
0 answers
190 views

Confidence intervals for binomial generalised linear model with cauchit link function

The correct way to calculate a confidence interval (CI) for a generalised linear model (GLM) and avoid the problems of normal approximation intervals has been adequately discussed by Gavin Simpson ...
user avatar
  • 41
0 votes
0 answers
3 views

Including control in group factors

with data frame below: I would like to get the control data presented in in both chair and table treatments , how do I do that? mean_dataf Product week Type Treatment Quality 1 Furniture ...
user avatar
1 vote
0 answers
23 views

How do I draw polygons in a scatterplot around groups of points based on a factor other than the factor my colors are based on? [closed]

I pasted the data here: The dataframe contains multiple observations on x and y per country. Each country is also part of a region. Based on this post, I managed to draw ploygons/clusters in the ...
user avatar
  • 11
0 votes
1 answer
640 views

Confidence band around regression line in R

I have a scatter plot that displays the trust in a country's scientists vs trust in scientists globally. based on data I created a scatter plot am trying to understand the confidence band in this ...
user avatar
  • 259
1 vote
0 answers
223 views

Which NMDS axes should I plot?

I have been running some non-metric multidimensional scaling analysis on a bray-curtis dissimilarity matrix (using ecodist::distance()). Theory suggests that we ...
user avatar
2 votes
1 answer
660 views

How can I plot a hyperbolic curve in R and get an equation of best fit? [closed]

Is there anyway to plot this data set using ggplot2 to get a graph with a hyperbolic line of beset fit as well as the equation for the line? ...
user avatar
  • 53
0 votes
1 answer
60 views

Showing the relationship between variables and drawing regression line

I am trying to solve a question which says: Use ggplot() to plot the graphs to see the relationship between variables GS with <...
user avatar
  • 137
2 votes
2 answers
150 views

Probability distribution of a random variable

The table below shows the number of ice creams brought and the number of customers brought that number of ice creams. ...
user avatar
  • 203
1 vote
2 answers
186 views

How to have graphical vizualisation of this table in R?

Actually, I have this kind of table I want to summarize into a graphic in R (preferably with ggplot2). Where the first three columns are the possible combinations of three methods (where 0 is absence ...
user avatar
2 votes
1 answer
356 views

Plot predict probabilities wiht ggplot2 and brms [closed]

I'm a PhD student in psycholinguistics and I'm having trouble in modeling some ordinal data. I have an ordinal response (completely disagree, disagree, neutral, agree, completely agree) and two ...
user avatar
-3 votes
1 answer
21 views

Problems to plot this barchart [closed]

I'm analysing a dataset about the suicides in the world based on age and location. I don't understand why I can't plot this barchart properly. When I access the suicbc variable typing ...
user avatar
  • 507
0 votes
1 answer
95 views

How to interpret the probability of a negative value in a density plot

I have the following density plot in R using ggplot ...
user avatar
  • 103
-1 votes
2 answers
73 views

Interpreting two linear regression outputs - one generic, one "faceted" (R, ggplot)

I am trying to analyse the potential relationship between Unemployment Rate and the occurrences of three types of crime (namely Anti-social behaviour, Theft, and Violence & Sexual Offences). First,...
user avatar
1 vote
0 answers
17 views

Am I interpreting this scatter plot correctly? ggplot in R [duplicate]

I am not sure if I am interpreting this scatter plot correctly. It's supposed to help analyse any potential relationship between unemployment rate and crime. X axis = crime occurrences (3 types of ...
user avatar
0 votes
2 answers
294 views

Beta regression fitted values

I have a beta regression model in R, have generated predicted (fitted) values based on my data, and plotted lines of those fitted values on a scatter plot of the actual data. I'm most used to GLMMs, ...
user avatar
  • 1
0 votes
1 answer
527 views

What is the difference between Rplot ACF and ggplot ACF?

I am using below two codes for plotting the autocorreleation of a time series, The data looks like below: ...
user avatar
3 votes
1 answer
52 views

Challenging visualization task: simultaneously visualizing 15 regions by 3 descriptive values

I have a rather challenging visualization task. 15 geographical regions (data points for plot), each described by 3 continuous values and all these values have confidence intervals. The aim is to ...
user avatar
  • 1,533
10 votes
2 answers
479 views

Statistics on LOESS smoothing

I'm trying to make sense of a data set which contains thousands of independent measurements of intensity in the form of a scatterplot. These measurements are dependent on two major variables: ...
user avatar
  • 101
1 vote
0 answers
80 views

Boxplot giving only points and no boxes [closed]

I have plotted two boxplots side by side from two different datasets in the same plot. I made some transformations first they had different number of observations. ...
user avatar
1 vote
1 answer
283 views

Plot correlation between random intercept and slope glmmTMB?

I am after some advice regarding how to plot the correlation between a random intercept and slope from a mixed model in glmmTBM? Below is a reproducible example. <...
user avatar
2 votes
1 answer
2k views

Plotting predicted values with lmer

I would like to plot a prediction graph in R using this model : ...
user avatar
  • 21
1 vote
0 answers
89 views

Center ggplot2 output image around x-axis label [closed]

The plot below shows some data I collected. It was plotted and saved using ggplot2: ...
user avatar
  • 11
0 votes
1 answer
62 views

All of my AU-PRC values are the same, is there something wrong with my code or models?

I have been doing some training of basic models for a certain binary outcome, and most of the training has been on optimizing the AUC. But when I plot the precision recall curves, I get essentially ...
user avatar
0 votes
2 answers
386 views

Interpretation of the Linear regression model using ggplot2

I used ggplot() for visualization and linear regression in R for this model. I am not confident if I interpreted the model right. These are my thoughts. The $p$-...
user avatar
0 votes
0 answers
31 views

How to evaluate which factor explains more of DV variance by eyeballing a violin plot

When glancing over data, I want to be able to quickly grasp which independent variable (factor) explains most of variance of a dependent variable (continuous). One way of reaching quick conclusions is ...
user avatar
  • 177
0 votes
0 answers
42 views

Stuck on confidence interval analysis for GLM

I'm really new to R, and sort of stats in general. I've been using a GLM to analyse a series of data, which is basically tracking how concentrations of DNA change over time, when different treatments ...
user avatar
  • 11
2 votes
0 answers
238 views

ggplot: help with interpreting standard error areas

I have made the graph below which shows the SE area around lines. However, I can't work out why they are so large for the 3rd graph. Graph code: ...
user avatar
0 votes
1 answer
435 views

Representing interaction plot for coxph model using plot_model() in R

I used coxph() to model the latency to a behavior as a function of the levels of a hormone in interaction with the treatment administered. Code for model is as follows ...
user avatar
  • 11
1 vote
1 answer
254 views

how to get predicted intervals? code no giving me those values [closed]

I am doing a cross validation in a training data and I am getting my predicted values with my test data. I want to do a plot with predicted versus observed with the predicted intervals but my code is ...
user avatar
  • 21
1 vote
2 answers
73 views

How should I color the dozens of curves in this plot?

I have 48 curves that I need to put in a single plot. Below is the current version of the plot; I made it using ggplot2. The curves belong to four groups; each group has 12 curves. I'd like to color ...
user avatar
  • 251
1 vote
1 answer
388 views

Fitting a broken stick regression with confidence intervals

I have been trying to fit a scatter plot of a broken stick regression with confidence intervals. What I would like is to have two different regression lines and confidence intervals between the ...
user avatar
  • 91
0 votes
1 answer
177 views

Plotting multiple binary glm lines

I'm trying to fit multiple lines on to one plot in R and I'c using code taken from https://stackoverflow.com/questions/36942443/plotting-a-multiple-logistic-regression-for-binary-and-continuous-values-...
user avatar
  • 1
1 vote
2 answers
1k views

How do I interpret and visualise my linear mixed effects model lmer() in R?

this may be a beginners question but any help is appreciated! I'm looking to compare the length frequencies of fish caught by two different nets using a linear mixed effect model. In this study the '...
user avatar
0 votes
0 answers
534 views

Performing a shapiro-wilk test on residuals from an LMER and repeated-measures ANOVA

I would like to perform a Shapiro-Wilk test on my data which takes the form of an LMER. The LMER model is named lmerabsolute. ...
user avatar

1
2 3 4 5