57,707 questions
0 votes
1 answer
101 views
Creating a bar graph with categories derived from multiple columns
I have generated the following summary of means and SDs for two parameters, SAR and ER, for several multi-column categories: structure(list(category = c("DIT GROUP\nCR 16.0005\nADB", "...
0 votes
1 answer
35 views
Adding geom_text in patchwork with shared y-axis and both positive and negative values
I have a patchwork plot consisting of a total of four plots. The procedure I’m asking about is mainly relevant for two of them, though I believe it can be applied to both. These two plots share a ...
0 votes
1 answer
72 views
Build forest plot for estimate comparison of multiple models using ggplot2. How to add text of CI?
I am trying to create a forest plot to compare estimates of different models. Tho goal is to plot all the estimates of the same predictor for the different models so they are comparable. For this I ...
0 votes
2 answers
77 views
Positioning of geom_text with negative stacked geom_bar
I have a ggplot2 plot with both positive and negative geom_bar values. For the geom_bar that shows the negative values, I’m having an issue where the position of geom_text is not displayed correctly. ...
2 votes
1 answer
92 views
Area with color gradient
I created this simple ggplot2 plot and would like to generate a vertical color gradient for the area between y = 0 and the respective values, possibly using geom_ribbon (?). However, I haven’t found ...
1 vote
1 answer
38 views
R geom_contour_filled date scale
I have 3D data that are all dates. I want to plot them with a contour. I have almost what I want with geom_contour_filled of package ggplot2 but I struggle to obtain a decent legend as dates (I'd like ...
3 votes
1 answer
67 views
How to use Times New Roman and italicization in equation in ggplot2?
I need all text in my graphs to be in Times New Roman. I also need the variables (R, P) generated in stat_poly_eq to be italicized. However, it seems that setting the font to Times New Roman ...
3 votes
1 answer
104 views
How to plot data like an animated ECG in R?
I have a 2 min data set sampled at 10 Hz that I want to plot like an ECG in R: I want to create a plot with a 30 s window, plot the first 30 s from left to right in real time, then after 30 s, the ...
1 vote
1 answer
110 views
stat_ellipse() in MCA plot does not cover jittered points / extends far beyond the data
I am creating a Multiple Correspondence Analysis (MCA) plot in R using FactoMineR, factoextra, and ggplot2. The goal is to add confidence ellipses around the archetype categories in the MCA space. The ...
0 votes
0 answers
52 views
RStudio error message said ggplot data is too long for aesthetic [closed]
I was meddling with R programming and trying to graph distribution of 2 variables in a data frame. However, the code gave me the warning: G2;H2;Warningh in geom_density(adjust = 1, alpha = 0.5) : [38;...
Advice
0 votes
5 replies
183 views
Drawing geometric diagrams in R, ggplot
To illustrate the ideas behind discriminant analysis, I created the image below containing a scatterplot with two groups and a plot of the densities of the scores, LD1 on the discriminant function. ...
2 votes
2 answers
101 views
Reorder stacked bar graph by value [duplicate]
What is the easiest-to-replicate way of reordering these bar graphs ( group1, group2) so that it is arranged in ascending order of col3 from bottom to top? I am looking for a solution that can be used ...
0 votes
1 answer
96 views
Confidence interval not covering the entire x axis [closed]
The confidence interval on my scatter plot doesn't cover the entire x axis, while the regression line fits the entire data set. The data that isn't covered by the c. interval doesn't have any missing ...
1 vote
1 answer
67 views
Error with stat_pointinterval() associated with aesthetics [closed]
I have previously used the stat_pointinterval() function from the R package tidybayes to make plots of the median and credible intervals around model parameters. While re-running code today, none of ...
3 votes
1 answer
122 views
Creating a plot for residuals
I have following linear regression model: library(nlme) library(lattice) data(Orthodont) model = lm( distance ~ age * Sex, Orthodont) lattice::bwplot(getGroups(Orthodont) ~ resid(model)) However, I ...