I have made a stripchart with a threshold marked in red. I would like to label the point that falls to the left of the threshold, but can't seem to get the 'text' function working at all.
Here is the stripchart code:
stripchart(ctrls$`Staining Green`, method="jitter", pch=4, xlab='Staining Green', cex.lab=2)
abline(v=5,col=2,lty=3)
I first tried to filter only those samples below the threshold:
Staining.Green <- filter(QCcontrols, Staining.Green < 5)
then adding the text with
text(Staining.Green$`Staining Green` + 0.1, 1.1, labels = Staining.Green$Sample_Name, cex = 2)
This didn't add any text to the chart.
Then I tried labeling all the points, in case I was making it too complicated, with variations on:
text(ctrls$`Staining Green` + 0.1, 1.1, labels = ctrls$Sample_Name)
Again, no text added, and no error message.
Any suggestions greatly appreciated!
Update: my ctrls object is more complex than I realized - maybe this is tripping me up:
List of 17
$ Restoration : num [1:504] 0.0799 0.089 0.1015 0.1096 0.1092 ...
..- attr(*, "threshold")= num 0
$ Staining Green : num [1:504] 25.1 23.5 21.1 19.7 22.3 ...
..- attr(*, "threshold")= num 5
$ Staining Red : num [1:504] 39.8 40.9 36.9 33.2 33.2 ...
..- attr(*, "threshold")= num 5.......```
Here is one example using the built in data set for
airquality
:Plot
Data
The lowest values of
Ozone
are:Edit:
Here's a quick demo with a list with a similar structure:
Note: Instead of explicitly including 5 for threshold you can substitute the
threshold
from your list attribute:Plot