Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
1 answer
922 views

How do I create two inserted plots by zooming in on two different areas? The original plot was made with `ggplot2`

I made a plot using ggplot2. From this plot, I want to highlight and zoom in on two different areas. To do this I used the ggforce package and the facet_zoom( ) function. However, this function only ...
Daniel Valencia C.'s user avatar
2 votes
0 answers
250 views

Discontinuous y-axis in inset plot with `ggplot2`

I am trying to insert a Kaplan-Meier inset "zoom" plot into the same KM plot (when Survival curves are very similar to allow more accurate inspection). This is currently used by many ...
q050cr's user avatar
  • 21
0 votes
1 answer
142 views

How do I add multiple subplots into a multirow figure in R?

i need to overlay multiple subplots onto a single plot which is already contained inside a multirow figure (see image) the reason why i need subplots instead of screen layout is because the figure ...
ivan866's user avatar
  • 572
1 vote
1 answer
88 views

How do I place insets at exact positions on a ggplot and set the colors of geom_segment?

I'm creating an illustration of how loess works. My two queries are at the end of this question. First, setup: library(tidyverse) data(melanoma, package = "lattice") mela <- as_tibble(...
mk9y's user avatar
  • 380
1 vote
1 answer
243 views

add plot inset (subplot) and multiple standard deviations to ggplot() with filtering based on conditions in R

Part 1: We are trying to make a ggplot() that shows multiple different summary statistics depending on the x-axis. We have more or less managed to do this, but are open to suggestions to help with ...
Blundering Ecologist's user avatar
0 votes
0 answers
629 views

Pesky border around a grob inset map

I made this map and it's nearly perfect except for the inset map has this pesky white borer around it. I would like for the inset to just have the black line border of the actual panel border, but not ...
Salma Abdel-Raheem's user avatar
1 vote
1 answer
893 views

Add a plotly figure as an inset to another plotly figure

I think this is a plotting situation that probably commonly occurs in data science. I have some data on which I'm conducting a statistical test and I want to plot the data together with the outcomes ...
dan's user avatar
  • 6,294
2 votes
0 answers
248 views

annotation_custom is not placing the grobs

Here is a code I have written: sp9 <- ggplot(PWPdf3_12_1250, aes(log10(Avsize), log10(Prob))) + geom_point(color= "blue") plotx <- ggplot(mpg, aes(displ, hwy)) + geom_point() + ...
Anirban Das's user avatar
1 vote
1 answer
782 views

map inset in MarMap / including a marmap file in ggplot2

I have a marmap plot of a marine sanctuary, but as it's very zoomed in, i'm trying to include an inset of the US state it's in (Massachusetts). currently, my code is as follows: library(marmap) ...
EmV's user avatar
  • 11
0 votes
1 answer
701 views

R studio: make small plot inside histogram and repeat it for as many times as I need, using par function

I need to make a histogram for my variable which is 'travel time'. And inside that, I need to plot the regression(correlation) data i.e. my observed data vs predicted. And I need to repeat it for ...
santosh's user avatar
  • 19
1 vote
1 answer
2k views

ggplot2 add two plots in grid.arrange with an inset in the second one in R

I'm able to print an inset and to create a grid from plots in ggplots. But I'm not able to create a grid with a plot on the left and 2 plots on the right one full size and the other in "inset". ...
M. Beausoleil's user avatar
0 votes
0 answers
693 views

Map Inset in R, viewport

I am trying to add inset of my polygon into a map. Page 11 of this pdf (https://journal.r-project.org/archive/2013-1/kahle-wickham.pdf) shows what im trying to get. Unfortunately I am new in R and ...
banshe's user avatar
  • 75
0 votes
1 answer
210 views

how to insert snapshots from rgl window into ordinary R plot

I am using R package rgl to create interactive plots and then its function rgl.snapshot to export images from them. I am wondering, however, if there is a way how to insert snapshots from the ...
Ondřej Mikula's user avatar
4 votes
3 answers
3k views

How can you get ggplot2 to display an inset figure when the main one has a log scale?

I have a figure with a log scale on the x-axis. Trying to create an inset figure doesn't work, but seems fine if the scale is changed to linear. Is there a way around this, or is it a limitation of ...
Andrew Steele's user avatar
3 votes
1 answer
2k views

How to change the background colour of a subplot/inset in R?

I'd like to add a subplot to an existing plot in R. The subplot (inset) should have a different background color. I tried the following: #install.packages("TeachingDemos", dependencies=T) library(...
R_User's user avatar
  • 11.1k
18 votes
4 answers
19k views

How to add an inset (subplot) to "topright" of an R plot?

I'd like to have an inset within a plot that makes up 25% of the width and height of the plotting area (area where the graphs are). I tried: # datasets d0 <- data.frame(x = rnorm(150, sd=5), y = ...
R_User's user avatar
  • 11.1k
6 votes
2 answers
2k views

Add an (SVG-) image to an existing graph in R

I'd like to an an image (ideally an SVG) as an inset to an existing graph in R and put a black border around the image. Is that possible with base-functions in R? Do I need packages for that?
R_User's user avatar
  • 11.1k
40 votes
6 answers
30k views

It is possible to create inset graphs?

I know that when you use par( fig=c( ... ), new=T ), you can create inset graphs. However, I was wondering if it is possible to use ggplot2 library to create 'inset' graphs. UPDATE 1: I tried ...
Sam's user avatar
  • 8,172