

Tip: use the dialog recall button for quick access to the scatter dialog. Load the patients data set and create a scatter histogram chart from the data. The schemes provided by Stata are only a starting point.

graph twoway (scatter read write if female=0) (scatter read write if female=1), /// legend (label (1 male) label (2 female)) We can use the msymol () option to control the marker symbols for the males and females. To adjust the transparency, in the Graph window, click the Graph Editor button to Start Graph Editor: Generate the same scatterplot, but this time, divide the plot by the dummy variable indicating whether the city is located in the south or not (C_SOUTH) Change the color of the symbol that you use in this scatter plot Change the type of symbol you use to a marker of your choice Interestingly, we have “job type” in our data, which comes somewhat close to job levels.

) Description twoway lfit calculates the prediction for yvar from a linear regression of yvar on xvar and plots the resulting line. The default is that the function is drawn over the range. For example, doing it without a loop, I would add the option: graph twoway `fig', legend(lab(1 "2010") lab(2 "2011") lab(3 "2012")) Is there a way to have the years appear in the legend as part of a loop? The years, and the number of years, change from dataset to dataset and this would be helpful. Another good resource is Trenton Mize's Sociological Science article on non-linear interactions. o Some Stata statistical commands also generate graphs, for example, the life table or marginplot commands. We can add a legend option to more clearly label the males and females, as shown below. It can also be a named logical vector to finely select the aesthetics to display. Let's now add it to our scatterplot by following the screenshot below.
