size of points in plot regarding to the frequency of particular value

Hello, I've been trying for a longer time now to adjust the size of points regarding to the frequency of values in a simple plot
Basically, I just need to make the points bigger in a place where the value is being more frequent, and make the points smaller where the value is not that much common.

This is the command i am using now (pardon my slovak), I know it should be easy but I am just a beginner trying to make the magic happen.

plot(eggs~ ord_all, order_FID_clutch, main=" ", xlab= "Poradie znášky", ylab="Veľkosť znášky [vajec]", las=1, cex=1)

Please help me I am desperate.
Thank you so much, Zuzana.

This kind of plot is easily done with ggplot. I do not know how to do it with the base plot() function. If your data frame already has a column that shows how frequent each value is, then the plot can be made like this:


DF <- data.frame(Value1 = 1:4, Value2 = c(2,5,9,14), 
                 Number = c(15, 8, 1, 26))
#>   Value1 Value2 Number
#> 1      1      2     15
#> 2      2      5      8
#> 3      3      9      1
#> 4      4     14     26
ggplot(data = DF, mapping = aes(x = Value1, y = Value2, size = Number)) +
  geom_point() + labs(x = "My X Label", y = "The Y Label",
                      title = "Title of the Plot")

Created on 2022-03-02 by the reprex package (v2.0.1)
If your data do not match that example, please show some of your data.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.