0

I make a histogram and a boxplot on different data. I want to display a specific value on these graphs (a point with a label); is it possible with boxplot and hist or is it better to use the ggplot2 package? I don't really know how to use it.

Thanks in advance for your help on this probably very simple question!

The first one represents the distribution of the share of couples without children in different localities and the second one the share of under 14 years old in the population of these localities.

I would like to indicate with a dot the value of a particular locality (present in the source data table)

hist(tableau.complet$proportion.coupleSenf, 
                main = "ex.main",
                xlab = "ex.x",
                ylab = "ex.y",
                col = "brown")

boxplot(tableau.complet$part.moins.14,
          main="ex..main",
          ylab="ex.ylab",
          col= "brown",
          las =1 )
NA_
  • 21
  • 4
  • Have you looked into [`geom_label()`/`geom_text()`](https://ggplot2.tidyverse.org/reference/geom_text.html)? Also please make your post [reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by providing `dput(tableau.complet)`. – jrcalabrese Jan 26 '23 at 16:51
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Jan 26 '23 at 17:22
  • Note that `h <- hist(...)` includes `h$mids` for the centers of each bar, and `bp <- boxplot(...)` allows simple integers for the location of each bar (along `x`) and the specific value (along `y`). – r2evans Jan 26 '23 at 17:39

0 Answers0