Supress labels in Stata figures

A great feature of Stata figures is that you can mix several plot types in one by using the twoway (...) (...) command. If you have several plots merged into one twoway graph and also want to add a legend, the legend might become a bit crowded. In the following example, legends are specified with the , legend(lab(1 "Scatter 1") lab (4 "Scatter 2")) option because I only wanted to mark the diamonds and circles in the legend:

Continue reading

Add time stamp to Stata figures

Especially in the early stages of a research project it might be good to “time stamp” figure so that you can later figure out when you created a certain figure. Of course you could just check the date in the explorer / finder, but you can also simply add a note to the figure with time and date of its creation:

Continue reading

Formatting text in Stata figures

This is not really new, but still comes in handy when formatting text in Stata figures. With a relatively simple code, you can make write text bold, in italics, and even greek letters

This special text is entered in curly brackets “{…}”:

  • Greek letters: {&alpha}, {&beta}, etc.
  • Text in italics: {it:Text in italics}
  • Text in bold: {bf: Text in bold}
  • Operators: {&le} (less than or equal to), {&ne} (unequal)
  • Subscripts and superscripts: e.g., write y{sup:2}{sup:ij}

Formatted numbers in figure (sub)headers

My dear colleague Anders Stenberg recently taught me a very nice trick to include numbers (such as: number of observations, R2s or any other number that can be saved to a local) in Stata figures. While including numbers can be simply done with a local, the trick is to have them nicely formatted. I.e., to include commas in a larger number, or to have decimals rounded. Continue reading