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

All Questions

1 vote
2 answers
56 views

function for geom_point to increase the scale_size

LATER EDIT: I finally figured out how to do it. It works with the following code: legend_size <- c(6,5,4,3,2,1,0,1,2,3,4,5,6) tt <- data.frame(x = c(27.9656, 27.1704, 26.2128 ,23.5634 ,25.3528 ...
Alex.V's user avatar
  • 55
0 votes
1 answer
45 views

how to have a legend for size of geom_points() and also set the size of the dots themselves?

I am trying to plot a sort of bubble plot but i am unable to set the size of the dots and have a legend explaining how the sizing works. These are two examples which combined give me the expected ...
gabt's user avatar
  • 774
1 vote
1 answer
120 views

how to change size of symbol in ggplot2 when size, shape, and color are set through geom_point?

The problem i am having is surely trivial, and yet i am unable to solve it. What i need is to have my own shape, colour, and size for the geom_point(). However, if i set it, the size of the symbols in ...
gabt's user avatar
  • 774
0 votes
0 answers
41 views

R's plotly ggplotly removing legend from a geom_point

I'm generating a simple geom_point plot with R ggplot2: library(dplyr) library(ggplot2) set.seed(1) df <- matrix(runif(16, 0, 10), nrow = 4, ncol = 4, dimnames = list(paste0("R", 1:4), ...
dan's user avatar
  • 6,242
0 votes
1 answer
98 views

How do I add a legend to ggplot with two scatter plots (geom_point() )

I have a table I read into R to plot with ggplots. I need to plot two sets of data points and also use an ifelse condition to be able to show specific genes. I would like to show a legend to the plot, ...
Assa Yeroslaviz's user avatar
2 votes
1 answer
102 views

How to show legend in a plot with both bars and points?

I have a dataframe the looks as follows: COUNTRY YEAR y AT 2019 25 AT 2020 38.0 AT 2021 23.4 BE 2019 11.1 BE 2020 18.6 BE 2021 15.0 DK 2019 ...
Bob's user avatar
  • 516
0 votes
1 answer
47 views

Colors and Shapes in geom_point legend

Hi there I have a very simple problem I think, but I'm not sure how to fix it. Basically, I have a geom_point plot where I have two approaches used and I wish to both differentiate shapes and colors ...
Matteo's user avatar
  • 209
0 votes
2 answers
212 views

Remove legend background for geom_point in combined ggplot

I want the legend to only show the black point for Proporció sobre la despesa total, without the purple background. Here a sample of my dataset: structure(list(decils_renda = structure(1:10, .Label = ...
Maria's user avatar
  • 309
0 votes
2 answers
147 views

Generate a legend and connecting data points (ggplot2)

I am pretty new to R. I've been trying (for the entire day) to plot data points on one graph and generate a legend for it. I have a raw data set about people's political ideology (factor, 1=liberal, 2=...
Youjeong Song's user avatar
1 vote
1 answer
553 views

legend not appearing for ggplot geom_point color aesthetics

I am attempting to generate a legend for ggplot geom_point color aesthetics. I have tried various combinations and browsed through already asked questions but have not come up with a solution. library ...
KP1's user avatar
  • 129
0 votes
1 answer
1k views

Add a legend to geom_point overlaid on geom_boxplot

So I create a boxplot of data and then add a set point over that data. I want my legend to capture what the data type of the geom_points represents. Thanks! ggplot(data = NULL) + geom_boxplot(data = ...
Ethan Lobdell's user avatar
0 votes
2 answers
854 views

Color legend with geom_text_repel and geom_point

how can be colored the dots next to the legend labels? scale_color_manual or scale_fill_manual do not work. Also how can I change the dots in the legend to squares? Thanks set.seed(1) library(ggplot2) ...
user7280624's user avatar