Sep 20, 2012 - When it comes to making figures in R, you can use any font you like. Today's guest post comes from Winston Chang, a software developer at RStudio — ed. [11] 'Courier New' 'Georgia' ## [13] 'Gujarati Sangam MN' 'Impact' ##. Base graphics pdf('plot_cm.pdf', family='CM Roman', width=5.5,.
@doncherry: The global change is trivial when it just involves including a package. Making that change only for a portion of the document is, however, unexpectedly challenging (and I fear that's one more reason for non-LaTeX-people to refuse LaTeX), and I suspect a significant portion of the 200+ upvoters so far came here specifically looking for a way to not make a global font change, as I just did. Widening the scope of the question to include global changes could make it less obvious that the question actually explains how to locally apply a font. – Oct 1 '15 at 9:03.
Another point of confusion for me is the following. The section Finding the name of the font begins with the following instruction 'If you are using system fonts, you can use the name of the font as it appears in any application on your system. (On a Mac, these are usually the fonts in /Library/Fonts.' .
The filenames appearing in /Library/Fonts are not necessarily the names of the fonts, as there need be no relation between the name of a font's file and the font's name. So which name are you referring to? File or font? In the latter case, how can it be found on Mac, Windows and Linux? – Jun 23 '17 at 9:28. ConTeXt MkIV In ConTeXt MkIV it is easy to use a font for a small section.
For larger parts of text I would recommend to use the or to write typescripts, because larger parts probably contain font switches that change the style. How do I find the right name of the font? First you have to install the font, if not already done. On Unix you can use the directory $HOME/.fonts for a per user or e.g.
/usr/local/share/fonts for a system wide installation. You have to point the environment variable OSFONTDIR to the directory where the fonts can be found: export OSFONTDIR='/usr/local/share/fonts;$HOME/.fonts' Then run mtxrun -script fonts -reload to regenerate the font database. Now you can query the database.
. This article describes how to add a text annotation to a plot generated using ggplot2 package. The functions below can be used:. geomtext: adds text directly to the plot. geomlabel: draws a rectangle underneath the text, making it easier to read.
annotate: useful for adding small text annotations at a particular location on the plot. annotationcustom: Adds static annotations that are the same in every panel It’s also possible to use the R package ggrepel, which is an extension and provides geom for ggplot2 to repel overlapping text labels away from each other. We’ll start by describing how to use ggplot2 official functions for adding text annotations. In the last sections, examples using ggrepel extensions are provided.
Text annotations using geomtext and geomlabel library(ggplot2) # Simple scatter plot sp. Annotationcustom: Add a static text annotation in the top-right, top-left, The functions annotationcustom and textGrob are used to add static annotations which are the same in every panel.The grid package is required: library(grid) # Create a text grob. Scatter plots with text annotations We start by creating a simple scatter plot using a subset of the mtcars data set containing 15 rows. Prepare some data: # Take a subset of 15 random points set.seed(1234) ss. Volcano plot genes.