Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
0 answers
43 views

I am trying to plot a global dataset of seamounts (full shapefile data can be found here). seamounts <- st_read("YessonEtAl2019-SeamountBases-V2.shp") I want to plot it centred on the ...
mikejwilliamson's user avatar
0 votes
0 answers
103 views

I am using a Unicode symbol in my plot. It looks fine in RStudio, but when I try to save them to PDF, it disappears. How one can keep the Unicode symbols in PDF? library(ggplot2) plot <- ggplot(...
Stataq's user avatar
  • 2,451
-2 votes
2 answers
110 views

I created a plot using ggplot in R. Below is a working example of my code. The problem is that the superscript in the axis labels is crammed together and the minus sign is halfway in the number. Why ...
Mick's user avatar
  • 17
0 votes
1 answer
94 views

I have this dataframe (see the code below) and the following plot. What I need is a plot like the mock-up attached (made in PowerPoint): In each facet panel, I want to show in light grey all the data ...
FraNut's user avatar
  • 696
3 votes
2 answers
144 views

I am trying to make a half-violin plot. I want to add the significant differences as brackets above the halves, with an asterisk indicating significance. Because I want to group the data into two ...
Gabriel's user avatar
  • 121
1 vote
0 answers
32 views

I recently updated both ggdist, tidybayes, and ggplot2 in R, and now some code that I had previously running is not longer working. Instead I get the error message: in self$geom$use_defaults(data, ...
Elliott Schmidt's user avatar
0 votes
0 answers
103 views

Image of two graphs combined together: I am currently attempting to make a ggplot with a boxplot and a path plot on the same image, the path plot is supposed to intersect with the median areas of the ...
Ethan's user avatar
  • 1
1 vote
2 answers
146 views

I am trying to create a series of plots using ggplot2 in R, and I want to customize the labels in the facet nested plots, particularly to include subscripts for the ICC labels. Below is my attempt, ...
Linus's user avatar
  • 355
-1 votes
0 answers
43 views

I have made a plot of a principle component analysis using ggplot2 (geompoint) and I currently have two legends, one showing the pch shape of each point and one showing the colour of each point. I ...
Logan Marshall's user avatar
3 votes
1 answer
71 views

I am trying to produce with faceted sjPlot lines, and geom_points. mtcars data supplied as an example. fit <- lm(mpg ~ cyl * hp * am, data = mtcars) I want to have slopes of mpg by hp for each cyl,...
Declan's user avatar
  • 33
3 votes
2 answers
85 views

I have this figure, and as you can see, the x-axis is labelled every 2nd year. Now, since it is visibly congested, I am trying to make it every 4th year, i.e. 1990, 1994, 1998 and so on. How do I go ...
Ryan Rajput's user avatar
0 votes
0 answers
89 views

This is the code: library(ggplot2) mortality_incidence_data <- read.csv("Report Data Death.csv") mortality_incidence_data$year <- factor(mortality_incidence_data$year,levels = c( &...
Ryan Rajput's user avatar
-2 votes
1 answer
72 views

I am creating a chart with two different geoms and would like to include them on separate rows (one row per geom) in a legend at the top of the chart. For example: ggplot(data = iris) + geom_point(...
Modern_ibex's user avatar
0 votes
1 answer
66 views

I have written the following function where when I pass the argument color_col the plot should color each of the traces with a seperate color. In this instance its the weekend column which has 3 ...
imantha's user avatar
  • 3,880
3 votes
1 answer
77 views

I would like to combine 3 plots(p1+p2+p3) together with conditional plot_layout() to p_all. However I could not get my if statement work. Could anyone guide me on this? p3 is for sure exist, but p1|...
Stataq's user avatar
  • 2,451
6 votes
2 answers
173 views

I'm working on a facet_nested_wrap plot (see image below) where I happen to have one of the aspect (CENT) having only one level, as opposed to two, as in the other (TELO). Is there a way to increase ...
Matteo's user avatar
  • 537
0 votes
0 answers
65 views

I am trying to create scatter plots showing the partial effects of the significant variables from my linear mixed effects model. The model is examining the association between various behavioural ...
Caledonian26's user avatar
6 votes
2 answers
151 views

I am working on highlighting groups of counties within Ohio and while I am happy with where I have ended up overall, I have one aesthetic issue I cannot seem to solve. Goal: Map of Ohio with grouped ...
S. Nelson's user avatar
1 vote
1 answer
94 views

I'm trying to make a line chart of the density of different species along a vegetation transect. There are two transects (Transect A and Transect B), which I would like to plot separately. "Cover&...
ayesha's user avatar
  • 153
0 votes
1 answer
138 views

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", "...
salconflu's user avatar
0 votes
1 answer
43 views

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 ...
Felix's user avatar
  • 61
0 votes
1 answer
97 views

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 ...
Linus's user avatar
  • 355
0 votes
2 answers
84 views

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. ...
Felix's user avatar
  • 61
2 votes
1 answer
97 views

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 ...
Felix's user avatar
  • 61
1 vote
1 answer
46 views

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 ...
Grégwar's user avatar
3 votes
1 answer
70 views

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 ...
Mariah Howell's user avatar
3 votes
1 answer
108 views

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 ...
Mata's user avatar
  • 705
1 vote
1 answer
110 views

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 ...
Nikos's user avatar
  • 413
Advice
0 votes
5 replies
188 views

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. ...
user101089's user avatar
  • 4,083
2 votes
2 answers
106 views

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 ...
Wren's user avatar
  • 41
0 votes
1 answer
99 views

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 ...
Sven Amancic's user avatar
1 vote
1 answer
100 views

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 ...
tnt's user avatar
  • 1,527
3 votes
1 answer
125 views

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 ...
Daniel Lobo's user avatar
4 votes
2 answers
123 views

I have a set of two variables measured over time: data <- structure(list( time = c(0, 30, 60, 90, 120, 150, 210, 270, 330, 1350, 1470, 1710), var1 = c(0.963, 0.942, 0.921, 0.933, 0.868, 0.727, 0....
Martin's user avatar
  • 45
1 vote
1 answer
84 views

I am running code that I previously used to create maps for my data. The background for the map is: library(rnaturalearth) library(sf) countries <- ne_countries(scale = "medium", ...
Devon's user avatar
  • 41
0 votes
1 answer
87 views

I am trying to generate a sankey diagram using the ggsankeyfier package. The problem I have is that the nodes and flows are misalgined when using multiple facets as you can see in the picture. Does ...
iouraich's user avatar
  • 3,056
2 votes
1 answer
114 views

I have created a simple line chart with ggplot2 and would like to use geom_textpath to display the labelnames in the chart. The problem is that the labels currently overlap too much. How can I change ...
Felix's user avatar
  • 61
3 votes
2 answers
143 views

When plotting a SpatVector using ggplot2, if I define a projection using coord_sf(), it adds these lines that I think come from the data wrapping around the plot extent. Best way to fix? library(...
Henry Holm's user avatar
1 vote
1 answer
72 views

I'm attempting to create a coefficient plot for multiple linear models using ggplot2 in R, but I'm facing an issue with overlapping points and error bars when displaying the estimates. I've written a ...
Linus's user avatar
  • 355
0 votes
1 answer
89 views

I'm getting an odd problem where I've attempted to plot a scatter graph and fit a quadratic regression line to it. I used stat_smooth() to make the line, and stat_regline_equation() to print the ...
CJG's user avatar
  • 3
2 votes
0 answers
107 views

I am using ggplot2 to create a horizontal bar chart. I use position_stack() function from the ggplot2 library version 4.0.0 on a Windows 11 computer. packageVersion("ggplot2") [1] ‘4.0.0’ ...
Homer Jay Simpson's user avatar
2 votes
1 answer
78 views

This legend should have an additional event "Spring", which is represented by a point in the legend, that is below the information about the bars. I can't get this to show up in the legend. ...
Christy Meredith's user avatar
11 votes
2 answers
632 views

I am trying to recreate this graph I saw in this book, but instead make it as a histogram. This is my code so far, but it is not looking as good: set.seed(123) library(dplyr) library(ggplot2) # ...
Victor Hartman's user avatar
-3 votes
2 answers
79 views

I have below data and ggplot dat = structure(list(date = structure(c(19722, 19388, 19691, 19447, 19508, 19600, 19722, 19630, 19691, 19874, 19813, 19874, 19813, 19874, 19813, 19813, 19874, 19874, ...
Bogaso's user avatar
  • 3,896
1 vote
0 answers
83 views

On r-graph-gallery.com one can find an example on how to create a hierarchical edge bundling network visualisation. The code looks like this: # create a data frame giving the hierarchical structure of ...
meier_flo's user avatar
  • 146
4 votes
2 answers
158 views

I am doing some time series clustering, and would like to align the dendrogram with the time series shapes. This is almost there: library(ggplot2) library(reshape2) library(stats) library(patchwork) ...
Neal Fultz's user avatar
  • 9,779
3 votes
0 answers
103 views

I'm trying to wrap long vertical text (like Y-axis label), that needs to be in serif font. I use ggtext::element_textbox_simple. However, it seems that text is being "squished" (spaces are ...
Łukasz Deryło's user avatar
4 votes
3 answers
251 views

I'm trying to write an extension for ggplot2 in R that lets a user add text annotations in the margins. My idea is to put the text in new rows/columns that get added to the plot's gtable. Hopefully ...
Dagremu's user avatar
  • 521
1 vote
1 answer
79 views

I have a ridge plot where I'm colouring points by a grouping that doesn't affect the ridges. I would like to have a continuous point_colour legend using viridis, but can't figure out how to control it....
user2602640's user avatar
  • 1,097
8 votes
2 answers
310 views

How do I make the line in the graph above a double line like shown in below? Some example code: df <- data.frame(dose=c("D0.5", "D1", "D2"), len=c(4.2,...
J. Doe's user avatar
  • 1,882

1
2 3 4 5
1155