Example: confidence

graph twoway scatter — Twoway scatterplots plottypes, …

Twoway scatter Twoway scatterplotsDescriptionQuick startMenuSyntaxOptionsRemarks and examplesReferencesAlso seeDescriptionscatterdraws scatterplots and is the mother of all thetwowayplottypes, such aslineandlfit(see [G-2] graph Twoway lineand [G-2] graph Twoway lfit).scatteris both a command and aplottypeas defined in [G-2] graph Twoway . Thus the syntaxforscatteris. graph Twoway scatter .. Twoway scatter .. scatter ..Being a plottype,scattermay be combined with other plottypes in thetwowayfamily (see[G-2] graph Twoway ), as in,. Twoway ( scatter ..) (line..) (lfit..)..which can equivalently be written as. scatter ..|| line..|| lfit..||..Quick startScatterplot ofy1versusxtwoway scatter y1 xSame as abovescatter y1 xScatterplot overlaid with a line showing the linear relationship betweeny1andxtwoway scatter y1 x || lfit y1 xAs above, but suppress the legendtwoway scatter y1 x || lfit y1 x, legend(off)As above, but with a separate graph area for each level ofcatvartwoway scatter y1 x || lfit y1 x, by(catvar, legend(off))Scatterplot overlaid with a lowess plottwoway scatter y1 x || lowess y1 xScatterplot with different markers showingcatvar=0 andcatvar=1twoway scatter y1 x if catvar==0 || scatter y1 x if catvar==1As above, but use Zero and One in the legend to indicate the value ofcatvartwoway scatter y1 x if catvar==0 || scatter y1 x if catvar==1, ///legend(order(1 "Zero" 2 "One"))12 graph Twoway scatter

graph twoway scatter — Twoway scatterplots DescriptionQuick startMenuSyntax OptionsRemarks and examplesReferencesAlso see Description scatter draws scatterplots and is the mother of all the twoway plottypes, such as line and lfit (see[G-2] graph twoway line and[G-2] graph twoway lfit).

Tags:

  Graph, Scatter, Twoway, Scatterplots, Graph twoway scatter twoway scatterplots, Twoway graph

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of graph twoway scatter — Twoway scatterplots plottypes, …

1 Twoway scatter Twoway scatterplotsDescriptionQuick startMenuSyntaxOptionsRemarks and examplesReferencesAlso seeDescriptionscatterdraws scatterplots and is the mother of all thetwowayplottypes, such aslineandlfit(see [G-2] graph Twoway lineand [G-2] graph Twoway lfit).scatteris both a command and aplottypeas defined in [G-2] graph Twoway . Thus the syntaxforscatteris. graph Twoway scatter .. Twoway scatter .. scatter ..Being a plottype,scattermay be combined with other plottypes in thetwowayfamily (see[G-2] graph Twoway ), as in,. Twoway ( scatter ..) (line..) (lfit..)..which can equivalently be written as. scatter ..|| line..|| lfit..||..Quick startScatterplot ofy1versusxtwoway scatter y1 xSame as abovescatter y1 xScatterplot overlaid with a line showing the linear relationship betweeny1andxtwoway scatter y1 x || lfit y1 xAs above, but suppress the legendtwoway scatter y1 x || lfit y1 x, legend(off)As above, but with a separate graph area for each level ofcatvartwoway scatter y1 x || lfit y1 x, by(catvar, legend(off))Scatterplot overlaid with a lowess plottwoway scatter y1 x || lowess y1 xScatterplot with different markers showingcatvar=0 andcatvar=1twoway scatter y1 x if catvar==0 || scatter y1 x if catvar==1As above, but use Zero and One in the legend to indicate the value ofcatvartwoway scatter y1 x if catvar==0 || scatter y1 x if catvar==1, ///legend(order(1 "Zero" 2 "One"))12 graph Twoway scatter Twoway scatterplotsMake the markers redscatter y1 x, mcolor(red)

2 Show markers as hollow circles with size proportional to frequency weight variablewvarscatter y1 x [fweight=wvar], msymbol(Oh)Add a marker at (15,22) with label Note this point scatter y1 x || scatteri 22 15 "Note this point"Scatterplot ofy1andy2versusxscatter y1 y2 xSpecify the title My Title and the subtitle My Subtitle scatter y1 y2 x, title("My Title") subtitle("My Subtitle")Specify a two-line titlescatter y1 y2 x, title("My Somewhat" "Long Title")Change the order of the plots in the legend to bey2andy1scatter y1 y2 x, legend(order(2 1))As above, and control the appearance of the graph using the monochrome schemes2monoscatter y1 y2 x, legend(order(2 1)) scheme(s2mono)Add random noise to the plot ofy3againstxto make overlapping points more visiblescatter y3 x, jitter(5)MenuGraphics> Twoway graph ( scatter , line, etc.) graph Twoway scatter Twoway scatterplots 3 Syntax[ Twoway ]scattervarlist[if][in][wei ght][,options]wherevarlistisy1[y2[..]]xo ptionsDescriptionmarkeroptionschange look of markers (color, size, etc.)

3 Markerlabeloptionsadd marker labels; change look or positionconnectoptionschange look of lines or connecting methodcompositestyleoptionoverall style of the plotjitteroptionsjitter marker positions using random noiseaxischoiceoptionsassociate plot with alternative axistwowayoptionstitles, legends, axes, added lines and text, by, regions, name,aspect ratio, (symbolstylelist)shape of markermcolor(colorstylelist)color and opacity of marker, inside and outmsize(markersizestylelist)size of markermsangle(anglestyle)angle of marker symbolmfcolor(colorstylelist)inside or fill color and opacitymlcolor(colorstylelist)color and opacity of outlinemlwidth(linewidthstylelist)thickn ess of outlinemlalign(linealignmentstyle)outlin e alignment (inside, outside, center)mlstyle(linestylelist)overall style of outlinemstyle(markerstylelist)overall style of markermarkerlabeloptionsDescriptionmlabe l(varlist)specify marker variablesmlabposition(clockposlist)where to locate labelmlabvposition(varname)

4 Where to locate label 2mlabgap(sizelist)gap between marker and labelmlabangle(anglestylelist)angle of labelmlabsize(textsizestylelist)size of labelmlabcolor(colorstylelist)color and opacity of labelmlabformat(%fmtlist)format of labelmlabtextstyle(textstylelist)overall style of textmlabstyle(markerlabelstylelist)overa ll style of label4 graph Twoway scatter Twoway scatterplotsconnectoptionsDescriptioncon nect(connectstylelist)how to connect pointssort[(varlist)]how to order data before connectingcmissing({y|n}..)missing values are ignoredlpattern(linepatternstylelist)lin e pattern (solid, dashed, etc.)lwidth(linewidthstylelist)thickness of linelcolor(colorstylelist)color and opacity of linelalign(linealignmentstyle)line alignment (inside, outside, center)lstyle(linestylelist)overall style of linecompositestyleoptionDescriptionpstyl e(pstylelist)all ()options aboveSeeAppendix: Styles and composite stylesunderRemarks and (#)perturb location of pointjitterseed(#)random-number seed forjitter()SeeJittered markersunderRemarks and (#[#.)]

5 ])whichyaxis to usexaxis(#[#..])whichxaxis to usetwowayoptionsDescriptionaddedlineopti onsdraw lines at specifiedyorxvaluesaddedtextoptionsdispl ay text at specified (y,x) valueaxisoptionslabels, ticks, grids, log scalestitleoptionstitles, subtitles, notes, captionslegendoptionslegend explaining what means whatscale(#)resize text and markersregionoptionsoutlining, shading, aspect ratioaspectoptionconstrain aspect ratio of plot regionscheme(schemename)overall lookplay(recordingname)play edits fromrecordingnameby(varlist,..)repeat for subgroupsnodrawsuppress display of graphname(name,..)specify name for graphsaving(filename,..)save graph in fileadvancedoptionsdifficult to explainaweights,fweights, andpweights are allowed; see[U] Twoway scatter Twoway scatterplots 5 Optionsmarkeroptionsspecify how the points on the graph are to be designated. Markers are the ink usedto mark where points are on a plot. Markers have shape, color, and size, and other [G-3]markeroptionsfor a description of markers and the options that specify (O D S T + X o d s t smplus x)is the (i)will suppress the appearanceof the marker labels to appear next to or in place of the markers.

6 For instance, if youwere plotting country data, marker labels would allow you to have Argentina , Bolivia ,.., appearnext to each point and, with a few data, that might be desirable. See [G-3]markerlabeloptionsfor a description of marker labels and the options that control default, no marker labels are displayed. If you wish to display marker labels in place of themarkers, specifymlabposition(0)andmsymbol(i).conn ectoptionsspecify how the points are to be connected. The default is not to connect the ()specifies whether points are to be connected and, if so, how the line connecting themis to be shaped. The line between each pair of points can connect them directly or in that the data be sorted by thexvariable before the points are connected. Unless youare after a special effect or your data are already sorted, do not forget to specify this option. If youare after a special effect, and if the data are not already sorted, you can specifysort(varlist)tospecify exactly how the data should be sorted.

7 Understand that specifyingsortorsort(varlist)when it is not necessary will slow Stata down a little. You must specifysortif you wish toconnect points, and you must specify thetwowayoptionby() (y)andcmissing(n)specify whether missing values are ignored when points areconnected; whether the line should have a break in it. The default iscmissing(y), meaning thatthere will be no ()specifies how the style of the line is to be drawn: solid, dashed, ()specifies the width of the ()specifies the color and opacity of the ()specifies the alignment of the ()specifies the overall style of the [G-3]connectoptionsfor more information on these and related options. See [G-4]Concept:linesfor an overview of (pstyle)specifies the overall style of the plot and is a composite ofmstyle(),mlab-style(),lstyle(),connect (), andcmissing(). The default ispstyle(p1)for the first plot,pstyle(p2)for the second, and so on. SeeAppendix: Styles and composite stylesunderRemarksand (#)adds spherical random noise to the data before plotting.

8 #represents the size of the noiseas a percentage of the graphical area. This option is useful when plotting data which otherwisewould result in points plotted on top of each other. SeeJittered markersunderRemarks specified arejitter(5)orjitter(6);jitter(0)is the (#)specifies the seed for the random noise added by thejitter()option.#shouldbe specified as a positive integer. Use this option to reproduce the same plotted points when thejitter()option is graph Twoway scatter Twoway scatterplotsaxischoiceoptionsare for use when you have [G-3]axischoiceoptionsfor more , which specify that horizontal or vertical lines be drawn on the graph ; see[G-3]addedlineoptions. If your interest is in drawing grid lines through the plot region, , which specify text to be displayed on the graph (inside the plot region); see[G-3] , which allow you to specify labels, ticks, and grids. These options also allow you toobtain logarithmic scales; see [G-3] you to specify titles, subtitles, notes, and captions to be placed on the graph ;see [G-3] , which allows specifying the legend explaining the symbols and line styles used;see [G-3] (#), which makes all the text and markers on a graph larger or smaller (scale(1)meansno change); see [G-3] , which allow you to control the aspect ratio and to specify that the graph beoutlined, or given a background shading; see [G-3] (schemename), which specifies the overall look of the graph ; see [G-3] (recordingname)applies the edits fromrecordingnameto the graph , whererecordingnameis the name under which edits previously made in the graph Editor have been recorded andstored.

9 SeeGraph Recorderin [G-1] graph (varlist,..), which allows drawing multiple graphs for each subgroup of the data; see[G-3] , which prevents the graph from being displayed; see [G-3] (name), which allows you to save the graph in memory under a name different fromGraph;see [G-3] (filename[, asis replace]), which allows you to save the graph to disk; see [G-3] options that allow you to suppress the display of the graph , to name the graph , [G-3] Twoway scatter Twoway scatterplots 7 Remarks and are presented under the following headings:Typical useScatter syntaxThe overall look for the graphThe size and aspect ratio of the graphTitlesAxis titlesAxis labels and tickingGrid linesAdded linesAxis rangeLog scalesMultiple axesMarkersWeighted markersJittered markersConnected linesGraphs by groupsSaving graphsVideo exampleAppendix: Styles and composite stylesTypical useThe scatter plottype by default individually marks the location of each point.

10 Use ( life expectancy, 1900-1940). scatter le year404550556065 Life expectancy19001910192019301940 Year8 graph Twoway scatter Twoway scatterplotsWith the specification of options, you can produce the same effect astwoway connected(see[G-2] graph Twoway connected),. scatter le year, connect(l)404550556065 Life expectancy19001910192019301940 Yearortwoway line:. scatter le year, connect(l) msymbol(i)404550556065 Life expectancy19001910192019301940 YearIn fact, all the other Twoway plottypes eventually work their way back to is the mother of all Twoway graphs in syntaxSee [G-2] graph twowayfor an overview ofgraph twowaysyntax. Especially forgraph twowayscatter, the only thing to know is that if more than two variables are specified, all but the last aregiven the interpretation of beingyvariables. For example,. scattery1var y2var xvargraph Twoway scatter Twoway scatterplots 9would ploty1varversusxvarand overlay that with a plot ofy2varversusxvar, so it is the same astyping.


Related search queries