Do not type the word if, as that is assumed. You can then type a condition in the If: box, and only observations that meet the condition will be included in the plot. If you only want to include certain observations, you can specify which ones by clicking on the if/in tab. The legend text is drawn from the variable labels, but you could override all these default behaviors if you so desired. Note how Stata automatically puts the two variables in different colors and adds a legend explaining which is which. The result will be a scatter plot with both variables. The trunk variable qualifies, so type it in the Y variable box after mpg and click Submit again. To make a sensible graph with two Y variables (without having multiple scales) we need variables with similar values. Stata does not allow you to select multiple variables from the list with the mouse, but it has no trouble understanding multiple variables in the Y variables box as long as you put them there yourself. If you want to add a second Y variable to the scatterplot, the easiest way is to type its name into the Y variable box after the one you've already selected.
#Stata mean by group professional#
Click Submit now and you should get a simple but professional looking scatter plot. This allows you to look over the results and then easily make adjustments and try again. If you click Submit, the graph will be created without closing the dialog box. (Note: Linux Stata does not allow you to select variables so you'll need to type their names. For the Y variable select or type mpg, and for the X variable select or type weight. Leave the category set to Basic plots and the type set to Scatter. You'll then get a dialog box where you can describe the plot you want.
#Stata mean by group plus#
The basic twoway dialog box will allow you to define as many plots as you need, plus control the other characteristics of the graph. Also, a single graph may contain multiple plots. In Stata terms, a plot is some specific data visualized in a specific way, for example "a scatter plot of mpg on weight." A graph is an entire image, including axes, titles, legends, etc. Stata refers to any graph which has a Y variable and an X variable as a twoway graph, so click Graphics, Twoway graph. We'll start with a simple scatter plot with weight as the X variable and mpg as the Y variable. Creating Graphs Using the Graphical User Interface
Creating a graph will never change your data, so the worst that can happen is that your graph turns out to be useless or just plain ugly.
#Stata mean by group free#
Feel free to experiment as you go, especially with the settings we don't discuss (usually because they're either fairly obvious or rarely used). The examples in this article will use the automobile dataset that comes with Stata, so begin by typing: The best way to use this article is to read it at the computer and actually carry out the steps described. This article will discuss creating graphs using the Stata GUI, the structure of the graph command syntax (without dwelling too much on the details), some common types of graphs, and the graph editor. Thus it's better to create the graph you want in the first place where possible, but the editor is still a very useful addition.
If you later make any changes to your data, you'll have to start your graph over from scratch. This gives you even more control over your graph, but unlike the GUI for creating a graph the editor does not give you a command you can rerun later. Stata 10 also added a graph editor which allows you to modify a graph after you've created it. That doesn't mean you shouldn't put your graph commands in do files once you've created them, but it does mean that for complex graphs you can use the GUI to create the commands you'll store. What's more, Stata's Graphical User Interface (GUI) organizes the various graphing options in an intuitive way so you can find them when you need them without memorizing the syntax for each one. However, you'll probably only need to make a few different kinds of graphs, and in most cases Stata's default settings will be fine. Between the wide variety of graphs you can make and the sheer number of details you can control in a graph, Stata graphics can be a daunting subject. Stata includes a rich set of tools for creating publication-quality graphics.