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
0answers
9 views

How to properly plot a histogram with dates using ggplot? [migrated]

I would like to create an interactive histogram with dates on the x-axis. I have used ggplot+ggplotly. I've read I need to use to pass the proper information using the "text=as.character(mydates)&...
1
vote
0answers
21 views

Creating vertical line in ggplot with time series data [migrated]

I have data in tsibble format that I labelled tsdb: ...
0
votes
0answers
15 views

What is the empirical CDFs for confidence interval widths? [duplicate]

I'm working on a problem in which I investigate three different parameterisations, $\theta=\lambda,\;\theta=\sqrt{\lambda},\;\theta=log(\lambda)$ for some observations $y_i \sim Pois(\lambda)$. I then ...
0
votes
0answers
4 views

ggplot2 in r box plot fill colour very pale? [migrated]

I've created boxplots using ggplot, using instructions online but the fill colour is really transparent and not showing up well compared to what it looks like on other people's how can I solve this?
0
votes
1answer
42 views

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

I have the following density plot in R using ggplot ...
0
votes
0answers
3 views

How to get a PCA plot with PC3 and PC4 with ggbiplot [migrated]

I need some help to get PC3 and PC4 for my data. ...
0
votes
0answers
13 views

Error when creating SVM plot in R: Error in UseMethod(“predict”) : no applicable method for 'predict' applied to an object of class “svm”

I am trying to create a plot for weighted SVM model The following commands: X <- subset(mydata, select=-STATUS) Y <- subset(mydata, select=STATUS) wts<-1/table(Y) best_model= svm(mydata, Y, ...
0
votes
0answers
22 views

How to fit a non-linear model to data using a predefined function

I tried to fit a Difference of Gaussians (DoG) function to my data that has a non-linear relationship. The DoG function is as follows: ...
-1
votes
1answer
32 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,...
1
vote
0answers
14 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 ...
0
votes
2answers
57 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, ...
0
votes
0answers
13 views

estimaing OR from logistic regression with interaction in R

I am running a logistic regression with two explanatory variables x1 (0=No, 1=yes) and x2 (0=bad, 1=good), and the outcome y (0=alive, 1=dead). But I also want to test interaction between the two ...
0
votes
0answers
13 views

Non-linear relationship between x and y in panel data

I was expecting a positive relationship between the mean age and my dependent variable in my PANEL data set. However, when trying to fit a regression, the result was negative. When plotting the ...
0
votes
1answer
55 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: ...
3
votes
1answer
48 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 ...
10
votes
2answers
111 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: ...
0
votes
0answers
14 views

Determining whether one variable is significantly different from multiple others in ggplot2

I have a dataset with the concentrations of six drugs for four diseases and eight participants ("Donors") in ±O2 conditions. I suspect that Donor 1 in my dataframe below might be an outlier ...
0
votes
0answers
29 views

2 D density plot interpretation and manipulating the data?

I have a data frame like this: ...
1
vote
0answers
22 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. ...
0
votes
1answer
34 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. <...
0
votes
0answers
14 views

Plotting accuracies obtained through three different methods

I want to plot accuracies for 100 products obtained through three different methods. The data resembles the table below. What is the best way to represent visually these data? I was thinking of having ...
1
vote
1answer
97 views

Plotting predicted values with lmer

I would like to plot a prediction graph in R using this model : ...
1
vote
0answers
45 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: ...
0
votes
0answers
46 views

Trying to understand confidence levels in geom_smooth

Please plot the following code: ggplot(iris, aes(x = Petal.Width, y = Petal.Length)) + geom_point()+ geom_smooth() One can see all the data points plotted, as ...
0
votes
1answer
19 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 ...
0
votes
2answers
56 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$-...
0
votes
0answers
36 views

Calculating upper and lower confidence limits in R (99% and 95%) for a funnel plot that does NOT look at rate

I am a programmer but not a statistician. I am trying to create a funnel plot in R that looks at average chest tube duration for each individual hospital in hours. The x-axis has the total number of ...
0
votes
0answers
24 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 ...
0
votes
0answers
25 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 ...
2
votes
0answers
56 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: ...
0
votes
0answers
378 views

effect_plot, ggpredict, ggeffect: how to appropriately plot predicted values for a multiple linear regression?

I have a linear model with one main predictor of interest (GABA) and three covariates of no interest (BMI, Sex, Leg.Length): ...
0
votes
1answer
154 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 ...
1
vote
1answer
51 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 ...
0
votes
0answers
73 views

Adding confidence intervals to cumulative plot

I don't know why my question was closed previously. So I post it again and added some clarification. Hope this one is better! What am I doing? I want to plot the empirical cumulative probability of ...
1
vote
2answers
53 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 ...
1
vote
1answer
68 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 ...
0
votes
1answer
39 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-...
1
vote
2answers
250 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 '...
0
votes
0answers
61 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. ...
0
votes
0answers
21 views

Plotting the effect of more predictors over a dependent variable in GLMs

I want to plot the effect of the predictors considered (V1, V2....Vn) over a dependent variable based on the following results obtained from the summary of GLM (negative binomial distribution): ...
0
votes
0answers
9 views

independent variable with two levels having one level tested two times (other level sandwiched between) for each individual in R using lme

I am trying to run lme (nlme package) analysis on a dataset where each individual (insect) is tested against two gas levels(Air, hypoxia) over time. Dataset Dependent variable cycle Independent ...
0
votes
0answers
117 views

Visualising high dimensional data

My data is of the form $(x,y)\in\mathbb{R}^{20}\times\mathbb{R}$ where I denote the components of the independent variable $x=(x_1,...,x_{20})$. The $y$ variable is just a binary variable, $y\in\{0,1\}...
0
votes
1answer
53 views

Panel data OLS regression: plot and quadratic fitting line

I am conducting an OLS regression panel data analysis with package PLM in R. I use the following script to obtain a plot and fitting line of variables D and ...
1
vote
0answers
38 views
1
vote
1answer
735 views

Find axis intercept using ggplot [closed]

I'm currently doing an assignment using R about the photoelectric effect - for those who don't know, the y-axis intercept of the straight line created by the data is the work function ($\phi$) of the ...
5
votes
2answers
528 views

Explanation of centralityPlot in qgraph

I am using this code to get a centralityPlot. ...
1
vote
1answer
91 views

Plot Actual vs Predicted SVM Regression

I am building an SVM regression model using caret package, however, I am not sure what is the best approach to plot predicted vs actual values. I have the code below. You can reproduce the output by ...
2
votes
1answer
311 views

R density plot: Why are maximums points different in log scale versus linear scale?

I have data with around 25,000 rows myData with column attr having values from 0 -> 45,600. I am not sure how to make a ...
0
votes
1answer
602 views

How to use a custom method in ggplot2 for fitting smooth line [closed]

In normal cases we would have something that resembles ggplot(data=data.frame)+ geom_point(...)+ geom_smooth(...,method="lm") However, I do not want to fit a ...
0
votes
1answer
41 views

Best visualization for distributions at multiple time steps

I have a set of discrete observations at multiple time points (~40) all of which are at similar scales i.e., between 0 and 10, and have been trying to determine the best visualization to show the ...

1
2 3 4 5