Example: tourism industry

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.

6graph twoway scatter— Twoway scatterplots axis choice options are for use when you have multiple x or y axes. See[G-3] axis choice options for more information.twoway options include added line options, which specify that horizontal or vertical lines be drawn on the graph; see

Tags:

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

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.

2 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)

3 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.)

4 graph Twoway scatter Twoway scatterplots 3 Syntax[ Twoway ]scattervarlist[if][in][wei ght][,options]wherevarlistisy1[y2[..]]xo ptionsDescriptionmarkeroptionschange look of markers (color, size, etc.)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)

5 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)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}.)

6 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 (#[#.)]

7 ])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.

8 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.

9 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.

10 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. Understand that specifyingsortorsort(varlist)when it is not necessary will slow Stata down a little.


Related search queries