'Add text to R mosaicplot
I am trying to add text to individual tiles within a mosaicplot built using the base R function. However, I cant determine the coordinates of each center tile.
And no, I need to limit it to the mosaicplot function and don't want to use the vcd package. The code below demonstrates the addition of text based on the knowledge of where it should go. How can I derive these coordinates?
require(stats)
attach(Titanic)
mosaicplot(~ Sex + Survived, data = Titanic)
text( .4,.6, "where to get this number ?",col = "red", cex = 2)
text( .4,.1, "and how to find coordinates ?",col = "blue", cex = 1.5)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|