.ig >>
<STYLE TYPE="text/css">
<!--
        A:link{text-decoration:none}
        A:visited{text-decoration:none}
        A:active{text-decoration:none}
        OL,UL,P,BODY,TD,TR,TH,FORM { font-family: arial,helvetica,sans-serif;; font-size:small; color: #333333; }

        H1 { font-size: x-large; font-family: arial,helvetica,sans-serif; }
        H2 { font-size: large; font-family: arial,helvetica,sans-serif; }
        H3 { font-size: medium; font-family: arial,helvetica,sans-serif; }
        H4 { font-size: small; font-family: arial,helvetica,sans-serif; }
-->
</STYLE>
<title>ploticus: proc legendentry</title>
<body bgcolor=D0D0EE vlink=0000FF>
<br>
<br>
<center>
<table cellpadding=2 bgcolor=FFFFFF width=550><tr>
<td>
  <table cellpadding=2 width=550><tr>
  <td><br><h2>proc legendentry</h2></td>
  <td align=right>
  <small>
  <a href="../doc/welcome.html"><img src="../doc/ploticus.gif" border=0></a><br>
  Version 2.33 Jun'06
     </small><br><a href="../doc/scripthome.html">Scripts</a>
  <td></tr></table>
</td></tr>
<td>
<br>
<br>
.>>

.TH proc_legendentry PL "02-JUN-2006   PL ploticus.sourceforge.net"

.LP
Explicitly defines one legend entry.
This entry will be rendered the next time that 
\fBproc legend\fR is executed.
Usually, legends are built by successive plotting procs
having a \fClegendlabel\fR attribute.  However, if additional
flexibility is needed to make custom legend entries, this
proc may be invoked, once per legend entry.
.LP
For example, if a scatterplot is being created with various sized
points, there is no automatic way to get a legend of the various
point sizes, so \fBproc legendentry\fR could be executed (probably several 
times) to define legend information, then \fBproc legend\fR could be
executed to render it.
.LP
\fBproc legendentry\fR is also useful in setting up
.ig >>
<a href="#legenddriven">
.>>
\0legend-driven plots
.ig >>
</a>
.>>
which allow things like bar color, or scatterplot symbol color, size, or
shape to be controlled by a data field.
.LP
A gallery example that uses this proc is 
.ig >>
<a href="../gallery/scatterplot3a.html">
.>>
\0scatterplot3a.
.ig >>
</a>
.>>


.ig >>
<br><br><br>
.>>
.SH Attributes

.LP
\fBsampletype\fR 
.ig >>
&nbsp; &nbsp;
.>>
\fIt\fR
.IP \0
The type of sample to be displayed with the entry.
\fIt\fR may be one of:
\fCline\fR, \fCcolor\fR, \fCsymbol\fR, \fCtext\fR, \fCline+symbol\fR, or \fCtext+symbol\fR.
It may also be \fCnone\fR, in order to insert spacing into the legend.
.br
Example: \fCsampletype: text\fR

.ig >>
<br><br>
.>>

.LP
\fBlabel\fR  
.ig >>
&nbsp; &nbsp;
.>>
.ig >>
<a href="attributetypes.html#text">
.>>
\0text
.ig >>
</a>
.>>
.IP \0
The label for the legend entry.
The \fC\\n\fR construct can be used to force a line break when the legend is displayed, 
or the label can be wordwrapped using proc legend wraplen attribute.
.IP \0
Example 1: \fClabel: Eastern counties\fR
.IP \0
Example 2: \fClabel: Response curve \\n for 30 mg dose\fR

.ig >>
<br><br>
.>>

.LP
\fBtag\fR
.ig >>
&nbsp; &nbsp;
.>>
.ig >>
<a href="attributetypes.html#string">
.>>
\0string
.ig >>
</a>
.>>
.IP \0
An optional short identifier to be associated with the entry,
so that the entry can be accessed later.
Used with proc bars colorfield, as in this example:
.ig >>
<a href="../gallery/colorfld.htm">
.>>
\0colorfld
.ig >>
</a>
.>>

.ig >>
<br><br>
.>>

.LP
\fBdetails\fR  
.ig >>
&nbsp; &nbsp;
.>>
spec
.br
\fBdetails2\fR  
.ig >>
&nbsp; &nbsp;
.>>
spec
.br
\fBdetails3\fR  
.ig >>
&nbsp; &nbsp;
.>>
spec
.IP \0
Details regarding the rendering of the sample.  
Exactly what should be supplied for \fCdetails\fR, \fCdetails2\fR and
perhaps \fCdetails3\fR depends on the \fCsampletype\fR:
.nf

sampletype            details           details2        details3
----------          ------------      -------------   -----------
line                linedetails       -               -
color               color             -               -
symbol              symboldetails     -               -
text                a char or word    textdetails     -
line+symbol         linedetails       symboldetails   -
text+symbol         a char or word    textdetails     symboldetails
.fi
Explanations of types:
.ig >>
<a href="color.html">
.>>
\0color
.ig >>
</a>
.>>

.ig >>
&nbsp; &nbsp;
.>>

.ig >>
<a href="linedetails.html">
.>>
\0linedetails
.ig >>
</a>
.>>

.ig >>
&nbsp; &nbsp;
.>>

.ig >>
<a href="symboldetails.html">
.>>
\0symboldetails
.ig >>
</a>
.>>

.ig >>
&nbsp; &nbsp;
.>>

.ig >>
<a href="textdetails.html">
.>>
\0textdetails
.ig >>
</a>
.>>

.ig >>
<a name="legenddriven"></a>
.>>
.ig >>
<br><br><br>
.>>

.SH Legend-driven technique

.LP
This is a technique where
the legend table mechanism serves to map certain data values to ploticus
.ig >>
<a href="color.html">
.>>
\0colors
.ig >>
</a>
.>>
or other appearance attributes.
For example, suppose field 3 of your data is a group code of either A, B, or C.
You could use legend-driven technique to render 'A' data rows in red, 'B' in blue, and 'C' in green.

.LP
Here's how you do it:
.IP \0
1. For every expected variation,
set up an explicit legend entry using \fBproc legendentry\fR.
\fClabel\fR, \fCtag\fR, and \fCdetails\fR attributes should be supplied.
The \fCtag\fR will be compared with data field contents.
The \fCdetails\fR attributes control appearance.
.IP \0
2. Plot, using the appropriate attribute.  For example, if you are
doing a bar graph where individual bar colors are controlled by a data
field, you would use \fBproc bars\fR and specify a \fCcolorfield\fR.

.LP
Examples of legend-driven technique are
.ig >>
<a href="../gallery/colorfld.htm">
.>>
\0colorfld
.ig >>
</a>
.>>

.ig >>
<a href="../gallery/symfld.htm">
.>>
\0symfld
.ig >>
</a>
.>>

.ig >>
<a href="../gallery/symfld.htm">
.>>
\0symfld
.ig >>
</a>
.>>

.ig >>
<a href="../gallery/dupsleg.htm">
.>>
\0dupsleg
.ig >>
</a>
.>>

.ig >>
<br>
<br>
</td></tr>
<td align=right>
<a href="../doc/welcome.html">
<img src="../doc/ploticus.gif" border=0></a><br><small>data display engine &nbsp; <br>
<a href="../doc/Copyright.html">Copyright Steve Grubb</a>
<br>
<br>
<center>
<img src="../gallery/all.gif"> 
</center>
</td></tr>
</table>
<br>
<center>
Ploticus is hosted at http://ploticus.sourceforge.net <br>
<img src="http://sourceforge.net/sflogo.php?group_id=38453" width="88" height="31" border="0" alt="SourceForge Logo">
</center>
.>>
