From the course: Advanced and Specialized Statistics with Stata

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Controlling legends

Controlling legends - Stata Tutorial

From the course: Advanced and Specialized Statistics with Stata

Start my 1-month free trial

Controlling legends

- Let's go ahead and explore how to control and customize graph legends. Legends are an important part of graphs, because they help us identify what is happening on a graph. By default, Stata will always include a legend in a graph when there are multiple overlaying plots. However the default legend can sometimes be rather limited. So we're going to focus on how to embed legend control into our Stata code. This has the advantage of reducing the time spent on manually editing graphs at a later stage. Here's an example of a graph with a custom legend. This legend has custom labels, a reverse order, is stacked into columns, and is located within the data area of our graph on the bottom right hand side. To control the legend of the graph we need to use the legend option, that can be applied to any graph. The legend has various suboptions that allow us to fine tune how legends look like. Within the square brackets of the…

Contents