Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
168 views

r ggplot different size depending on shape

I have the following R code: x <- rep(c(1:5), 5) y <- rep(1:5, each=5) z <- rep(seq(0, 1000, 250), each=5) w1 <- c(15:18,25) w2 <- c("\u25A0", "\u25CF", "\u25B2&...
MPB_2022's user avatar
  • 147
0 votes
2 answers
149 views

In R, How to provide different shape and fill to the point, showing the legend for fill in ggplot?

For example, I have a data like below, population=rep(c("High", "Low"), time=5) year=rep(c("2020_H","2020_L","2020_O","2021_L","2021_O&...
Jin.w.Kim's user avatar
  • 884
3 votes
1 answer
989 views

R - change shape legend in ggplot2 (geom_col)

I am trying to change the shape of the legends for a geom_col plot. By default, the legend is square, and I would like to change to round (or triangle or anything else). Since the colors are ...
Qin's user avatar
  • 173
0 votes
2 answers
923 views

Squared shaped points change in legend - ggplot R

I am plotting a few points with ggplot and I would like to highlight one of them with an empty-square shaped point. I do it in the following way: ggplot(data.frame(x=rnorm(7), y=rnorm(7)), aes(x,y))+ ...
oibaFox's user avatar
  • 75
0 votes
0 answers
115 views

Problem with alignment of geom_point and geom_errorbar

I am trying to plot how different predictors associate with stroke and underlying phenotypes (i.e. cholesterol). In my data, I originally had working ggplot code in which shapes denoted the different ...
Rob's user avatar
  • 1
0 votes
2 answers
225 views

How can I control the geometry that is included in ggplot2 legends?

I'd like to know how I can modify the geometry that appears in my legends. Here's the example I have: stockmlp %>% ggplot(aes(y = RMSE, x = Depth, color = Depth)) + geom_boxplot(alpha = 0) + ...
CubicInfinity's user avatar
7 votes
1 answer
4k views

Circle shape without border in ggplot

As a direct follow up from my previous question (kindly answered by @PoGibas), I'm tweaking the appearance of my plot. I would like to use borderless circle shapes, but am having problems integrating ...
M.Teich's user avatar
  • 607
2 votes
2 answers
2k views

Plot ECDF data with ggplot2

I've a normalize data to plot ecdf but I couldn't change line shape, color and legend info. My Data is: EDCF.df <- structure(list(Length = c(11431L, 138250L, 109935L, 7615L, 5221L, ...
eabanoz's user avatar
  • 251
4 votes
3 answers
5k views

Don't show shape in color legend in a 2 legend plot (R ggplot2)

In my plot with 2 legends (one for shape and one for color), my boss finds it confusing that the color legend already has selected one of the shapes. An example: a <- data.frame(name = c("A","B","...
Amit Kohli's user avatar
  • 2,900
0 votes
1 answer
2k views

ggplot2 guide/legend on shape

I have a plot from the following script. require(ggplot2) df.shape <- data.frame( AX = runif(10), AY = runif(10), BX = runif(10, 2, 3), BY = runif(10, 2, 3) ) p <- ggplot(df.shape) p <- p ...
Hugh's user avatar
  • 15.9k
0 votes
1 answer
395 views

Display the correct filled shape in legend of ggplot2

I have following dataset: structure(list(com = c("v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "v", "t", "t", "t", "t", "t", "t",...
Alex's user avatar
  • 929
2 votes
2 answers
744 views

Can colors and shape be changed on a combined line and point plot while maintaining one legend per graph?

Using the following data frame: day <- gl(8,1,48,labels=c("Mon","Tues","Wed","Thurs","Fri","Sat","Sun","Avg")) day <- factor(day, level=c("Mon","Tues","Wed","Thurs","Fri","Sat","Sun","Avg"))...
blehman's user avatar
  • 1,960
16 votes
1 answer
26k views

ggplot2 custom legend shapes

When we have both shape and color legend in scatter plot, the shape of color legend is misleading: foo <- data.frame( length=runif(10), height=runif(10), group=as.factor(sample(3,10,rep=T)), ...
Ali's user avatar
  • 9,700