Blame | Last modification | View Log | RSS feed
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>SetLegend</title><link rel="stylesheet" type="text/css" href="phplotdoc.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="PHPlot Reference Manual" /><link rel="up" href="reference.html" title="PHPlot Function Reference" /><link rel="prev" href="SetLabelScalePosition.html" title="SetLabelScalePosition" /><link rel="next" href="SetLegendBgColor.html" title="SetLegendBgColor" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">SetLegend</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="SetLabelScalePosition.html">Prev</a> </td><th width="60%" align="center">PHPlot Function Reference</th><td width="20%" align="right"><a accesskey="n" href="SetLegendBgColor.html">Next</a></td></tr></table><hr /></div><div class="refentry"><a id="SetLegend"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">SetLegend</span></h2><p>SetLegend — Add text to a legend box</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">$plot->SetLegend(<em class="parameter"><code>$leg</code></em>)</pre></div><div class="refsect1"><a id="idp1378218276"></a><h2>Description</h2><p><code class="function">SetLegend</code> sets the text to be displayed in the legend.A legend is often needed when a plot contains more than one data set,to identify the purpose of the different data sets being plotted.The legend text consists of multiple lines, with each line identifying onedata set on the plot.PHPlot adds an identifying color box or shape marker next to each line in thelegend.</p></div><div class="refsect1"><a id="idp1378219588"></a><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>$leg</code></em></span></dt><dd><p>An array with each element containing the text for one line of the legend.Or, if not an array, the one line to be appended to the legend. See notes.</p></dd></dl></div></div><div class="refsect1"><a id="idp1378221196"></a><h2>Notes</h2><p>By default, no legend is displayed.</p><p>The legend usually needs to contain one line of text for each data set plottedon the graph, in the same order as the data array.You can supply all the legend lines in a single call to SetLegend as anarray, or you can build up the legend one line at a time with multiplecalls to SetLegend, supplying one line per call (in the same order asthe data sets in the data array).</p><p>By default, legend text lines are displayed in order from top to bottom inthe legend. (See <a class="xref" href="SetLegendReverse.html" title="SetLegendReverse"><span class="refentrytitle">SetLegendReverse</span></a> to reverse the order.)Each line also has a color box or shape maker with the corresponding color fromthe data colors array.The colors used in the legend color boxes or shape markers are independent ofany custom data color callback(see <a class="xref" href="adv-datacolor-callback.html" title="4.5. Custom Data Color Selection">Section 4.5, “Custom Data Color Selection”</a>).</p><p>To cancel a legend (perhaps as part of drawing multiple plots on an image),pass an empty array or NULL as <code class="varname">$leg</code>.</p><p>To control the legend position on the plot,use <a class="xref" href="SetLegendPixels.html" title="SetLegendPixels"><span class="refentrytitle">SetLegendPixels</span></a>, <a class="xref" href="SetLegendWorld.html" title="SetLegendWorld"><span class="refentrytitle">SetLegendWorld</span></a>,or the more general <a class="xref" href="SetLegendPosition.html" title="SetLegendPosition"><span class="refentrytitle">SetLegendPosition</span></a>.You can control the text and color box or shape marker alignment within thelegend using <a class="xref" href="SetLegendStyle.html" title="SetLegendStyle"><span class="refentrytitle">SetLegendStyle</span></a>.</p><p>Use <a class="xref" href="SetLegendUseShapes.html" title="SetLegendUseShapes"><span class="refentrytitle">SetLegendUseShapes</span></a> to select color boxes or shapemarkers in the legend.</p></div><div class="refsect1"><a id="idp1378226572"></a><h2>History</h2><p>Accepting NULL as a valid argument value was added in PHPlot-5.3.1.Through PHPlot-5.3.0, passing NULL would cause an error.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="SetLabelScalePosition.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="SetLegendBgColor.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">SetLabelScalePosition </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> SetLegendBgColor</td></tr></table></div></body></html>