Using External Fonts in Stata Graphs
There are many different fonts that can be downloaded externally and installed on your computer, that you can use with Stata. These fonts are not necessarily just new alphabets, there are many fonts that attach pictures or symbols to keyboard letters. You might download a font with different transport pictures, for example. The website www.fonts4free.net has many different types of fonts that can be used for many different things. Below is an example of how to use external fonts in Stata, as well as how to install them on your computer.
How to Install:
***NOTE: Some fonts on the website www.fonts4free.net may be too old to install properly on new operating systems. The font used in this example has been tested and can be installed on both Windows 10 and Mac OSX 10.12 Sierra.***
Download the font from fonts4free.net by clicking on the download button on the top right of the page
Open the downloads folder and the font folder (if the download was contained in a folder)
Double-click on the font file, usually with the extension .tff or .otf
Click install – this option should appear for both Mac and Windows versions
How to Use:
Please note: In this section we make use of Stata macros. We won’t cover macros in detail here, so for now if you have never come across Stata macros before, all you need to know is that when you see apostrophes (or single-quotes) in the code these aren’t both apostrophes. The opening apostrophe is in fact a grave (or open quote), which is located on the tilde key (~) next to the 1 key on your keyboard. The closing apostrophe is an apostrophe (or closing quote) located on the quote key, next to the enter key.
Once the font is installed on your computer you can then use it in Stata. You must know the name of the font, which should be the same as the file name. It will usually also be shown on the website you downloaded the font from.
This is an example of an external font used in a graph. I use input to create a small dataset, before creating a label with the font I want in it, attaching it to a variable and using it in a scatter graph. The font used in this example is called “Rally Symbols”; it can be downloaded from www.fonts4free.net.
First I create a small dataset about helicopters and cars, in the command pane I type the following:
Now that I have my data, I create a scatter graph with my new Rally symbols. In the command pane, I type the following:
This gives me the following graph:
This graph tells me the fastest car in my dataset is faster than 2 of my helicopters, and about equal with the 3rd helicopter. So if you’re thinking about racing a slow helicopter, your best bet to win is the Honda Civic.
This can be a useful tool to make graphs easier to interpret. In the above graph the different pictures make it easy to differentiate between the cars and helicopters in the dataset, and it doesn’t require a legend to be understood.