Transcription of Title stata
1 Options for specifying legendsSyntaxDescriptionOptionsRemarks and examplesAlso seeSyntaxlegendoptionsDescriptionlegend( [contents][location])standard legend , contents and locationplegend([contents][location]) contourlinelegend, contents and locationclegend([suboptions]) contourplot legend ; see [G-3]clegendoptionlegend(),plegend(), andclegend()aremerged-implicit; see [G-4]concept: repeated the contents and the location of the (orderinfo)which keys appear and their orderlabel(labelinfo)override text for a keyholes(numlist)positions in legend to leave blankallgenerate keys for all symbolsstyle(legendstyle)overall style of legendcols(#)#of keys per linerows(#)or#of rows[no]colfirst 1, 2, 3 in row 1 or in column 1?
2 [no]textfirstsymbol-text or text-symbol?stacksymbol/text vertically stackedrowgap(relativesize)gap between linescolgap(relativesize)gap between columnssymplacement(compassdirstyle)alig nment/justification of key s symbolkeygap(relativesize)gap between symbol-textsymysize(relativesize)height for key s symbolsymxsize(relativesize)width for key s symboltextwidth(relativesize)width for key s descriptive textforcesizealways respectsymysize(),symxsize(),andtextwidt h()bmargin(marginstyle)outer margin around legendtextboxoptionsother text characteristicstitleoptionstitles, subtitles, notes, captionsregion(roptions)borders and background shadingorder(),labels(),holes(), andallhave no effect onplegend().
3 See [G-4]legendstyle, [G-4]relativesize, [G-4]compassdirstyle, [G-4]marginstyle,[G-3]textboxoptions, and [G-3] Options for specifying legendslocationDescriptionofforonsuppres s or force display of legendposition(clockposstyle)where legend appearsring(ringposstyle)where legend appears (detail)bplacement(compassdirstyle)place ment of legend when positioned in the plotregionspan centering of legendat(#)allowed withby()onlySeeWhere legends appearunderRemarks and examplesbelow, and seePositioning of titlesin [G-3]titleoptionsfor definitions , the argument allowed bylegend(order()), is defined as{#|-}["text"["text"..]]labelinfo, the argument allowed bylegend(label()), is defined as#"text"["text".]
4 ]roptions, the arguments allowed bylegend(region()), includeroptionsDescriptionstyle(areastyl e)overall style of regioncolor(colorstyle)line + fill color of regionfcolor(colorstyle)fill color of regionlstyle(linestyle)overall style of borderlcolor(colorstyle)color of borderlwidth(linewidthstyle)thickness of borderlpattern(linepatternstyle)border pattern (solid, dashed, etc.)margin(marginstyle)margin between border and contents of legendSee [G-4]areastyle, [G-4]colorstyle, [G-4]linestyle, [G-4]linewidthstyle, [G-4]linepatternstyle, and[G-4] ()option allows you to control the look, contents, and placement of the legend . Asample legend isoObservedLinear fitQuadratic fitThe above legend has threekeys.
5 Each key is composed of asymbolanddescriptive textdescribingthe symbol (whatever the symbol might be, be it a marker, a line, or a color swatch).contourlineandcontourplots have their own legends and do not place keys in the stan-dard legend legend (); see [G-2]graph twoway contourlineand [G-2]graph twoway place their keys in theplegend()and contour plots place their keys in theclegend(). Theplegend()is similar to thelegend()and is documented here. Theclegend()is documented in [G-3] Options for specifying legends 3 The legend options (more correctly suboptions) are discussed using thelegend()option, but mostapply equally to theplegend() (contents,location)defines the contents of the standard legend , along with how it is to look,and whether and where it is to be (contents,location)defines the contents of thecontourlineplot legend , along with howit is to look, and whether and where it is to be suboptions for use with legend () and plegend()order(orderinfo)specifies which keys are to appear in the legend and the order in which they areto (# #.)
6 Is the usual (1 2 3)would specify that key 1 is to appear first inthe legend , followed by key 2, followed by key (1 2 3)is the default if there are threekeys. If there were four keys,order(1 2 3 4)would be the default, and so on. If there werefour keys and you specifiedorder(1 2 3), the fourth key would not appear in the legend . If youspecifiedorder(2 1 3), first key 2 would appear, followed by key 1, followed by key dash specifies that text be inserted into the legend . For instance,order(1 2 - "text" 3)specifieskey 1 appear first, followed by key 2, followed by the texttext, followed by key 3. Imagine thatthe default key wereoObservedLinearQuadraticSpecifyingor der(1 - "Predicted:" 2 3)would produceoObservedPredicted:LinearQuadrati cand specifyingorder(1 - " " "Predicted:" 2 3)would produceoObservedPredicted:LinearQuadrati cNote carefully the specification of a blank for the first line of the text insertion; we typed" "andnot"".
7 Typing""would insert Options for specifying legendsYou may also specify quoted text after#to override the descriptive text associated with a (1 "Observed 1992" - " " "Predicted" 2 3)would change Observed inthe above to Observed 1992 . It is considered better style, however, to use thelabel()suboptionto relabel ()has no effect onplegend().label(#"text"["text"..])spec ifies the descriptive text to be displayed next to the#th text is allowed. Specifyinglabel(1 "Observed 1992")would change the descriptivetext associated with the first key to be Observed 1992 . Specifyinglabel(1 "Observed""1992-1993")would change the descriptive text to contain two lines, Observed followed by 1992 1993.
8 The descriptive text of only one key may be changed perlabel()suboption. Specify multiplelabel()suboptions when you wish to change the text of multiple ()has no effect onplegend().holes(numlist)specifies where gaps appear in the presentation of the ()has an effectonly if the keys are being presented in more than one row and more than one a case in which the default key isoObservedLinear fitQuadratic fitSpecifyingholes(2)would result inoObservedLinear fitQuadratic fitHereholes(2)would have the same effect as specifyingorder(1 - " " 2 3), and as a matter offact, there is always anorder()command that will achieve the same result asholes().order()has the added advantage of working in all ()has no effect onplegend().
9 Allspecifies that keys be generated for all the plots of the graph, even when the same symbol isrepeated. The default is to generate keys only when the symbols are different, which is determinedby the overall style. For example, in. scatter ylow yhigh x, pstyle(p1 p1) ||..there would be only one key generated for the variablesylowandyhighbecause they share thestylep1. That single key s descriptive text would indicate that the symbol corresponded to bothvariables. If, on the other hand, you typed. scatter ylow yhigh x, pstyle(p1 p1) legend (all) ||..then separate keys would be generated the above example, do not confuse our use ofscatter s optionpstyle()withlegend() ssuboptionlegend(style()).
10 Thepstyle()option sets the overall style for the rendition of () sstyle()suboption is documented directly no effect onplegend().style(legendstyle)specifies the overall look of the legend whether it is presented horizontally orvertically, how many keys appear across the legend if it is presented horizontally, etc. The optionslisted below allow you to change each attribute of the legend , butstyle()is the starting Options for specifying legends 5 You need not specifystyle()just because there is something you want to change. You specifystyle()when another style exists that is exactly what you desire or when another style wouldallow you to specify fewer changes to obtain what you [G-4]legendstylefor a list of available legend (#)androws(#)are alternatives; they specify in how many columns or rows (lines) the keysare to be presented.