I have several phylogenetic trees imported into R from Newick format. I am using the ape package to plot the trees with plot.phylo command. I would like to be able to change the font family (not only the size, which I can do with cex, or color with col) of the tip labels to monospace. The plot command does take family argument, but nothing happens when I pass family="mono". I tried including it in par with no success either.
library(ape)
tr <- rtree(10)
plot(tr)
gives me the same as
plot(tr, family="mono")
And I would like to see a change in font.
EDIT: The font-family specification seems to work when saving graphic to png, but not devSVG. How can I save updated font to SVG?
Finally, a success!
In order to be able to manipulate font-family when saving graphics in
SVGformat, I had to use the packagegrDevicesand methodcairo:which allows setting the
familyargument.For future reference, what did NOT work was:
devSVG(file, width, height)and then settingfamilyinparorplot,and
Cairo(file, width, height, type="svg")withfamilyinparorplot