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>SetPlotAreaPixels</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="SetPlotAreaBgImage.html" title="SetPlotAreaBgImage" /><link rel="next" href="SetPlotAreaWorld.html" title="SetPlotAreaWorld" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">SetPlotAreaPixels</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="SetPlotAreaBgImage.html">Prev</a> </td><th width="60%" align="center">PHPlot Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="SetPlotAreaWorld.html">Next</a></td></tr></table><hr /></div><div class="refentry"><a id="SetPlotAreaPixels"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">SetPlotAreaPixels</span></h2><p>SetPlotAreaPixels — Set the limits for the plot area in device coordinates</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">$plot->SetPlotAreaPixels([<span class="optional"><em class="parameter"><code>$x1</code></em></span>], [<span class="optional"><em class="parameter"><code>$y1</code></em></span>], [<span class="optional"><em class="parameter"><code>$x2</code></em></span>], [<span class="optional"><em class="parameter"><code>$y2</code></em></span>])</pre></div><div class="refsect1"><a id="idp1378561276"></a><h2>Description</h2><p><code class="function">SetPlotAreaPixels</code> sets the area to be used for the plotwithin the image, in device coordinates.(Device coordinates are GD coordinates, with the origin at the top leftof the image, X values increase to the right, Y values increase down,and the units in pixels.)The plot area is equal to the image area minus the margins. By default, themargins (and therefore the plot area) are automatically calculated based onthe space needed for titles, labels, etc.Use SetPlotAreaPixels to override these automatic calculations andcontrol the plot area.The four coordinate values are specified independently.SetPlotAreaPixels and <a class="xref" href="SetMarginsPixels.html" title="SetMarginsPixels"><span class="refentrytitle">SetMarginsPixels</span></a> perform the samefunction with different semantics.</p></div><div class="refsect1"><a id="idp1378563260"></a><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>$x1</code></em>, </span><span class="term"><em class="replaceable"><code>$y1</code></em></span></dt><dd><p>Device coordinates of the top left corner of the area to use for the plot.Each value is optional, and if omitted or NULL the automatically calculatedvalue is used.</p></dd><dt><span class="term"><em class="replaceable"><code>$x2</code></em>, </span><span class="term"><em class="replaceable"><code>$y2</code></em></span></dt><dd><p>Device coordinates of the bottom right corner of the area to use for the plot.Each value is optional, and if omitted or NULL the automatically calculatedvalue is used.</p></dd></dl></div></div><div class="refsect1"><a id="idp1378566404"></a><h2>Notes</h2><p>The plot area is equal to the image area minus the margins. By default, themargins (and therefore the plot area) are automatically calculated based onthe space needed for items <span class="emphasis"><em>outside</em></span> the plot area. Theplot area is then whatever space remains. Calculation for most plot typestakes into account the main title, axis titles, tick or data labels, and tickmarks (but not the legend, if drawn). For pie charts, only the main titlesize is used when calculating the needed margins.Use SetPlotAreaPixels to override these automatic calculations andcontrol the plot area.</p><p>SetPlotAreaPixels and <a class="xref" href="SetMarginsPixels.html" title="SetMarginsPixels"><span class="refentrytitle">SetMarginsPixels</span></a> perform the samefunction with different semantics. It makes no sense to use both - only thelast one called will have an effect.</p><p>SetPlotAreaPixels is also used when placing multiple plots on an image.See <a class="xref" href="adv-multiplot.html" title="4.8. Multiple Plots Per Image">Section 4.8, “Multiple Plots Per Image”</a> for more information.</p><p>Trailing defaulted arguments can be omitted, but non-trailing defaultedarguments must be specified as NULL. For example, to fix the bottom rightcorner of the plot area at (600, 400) and let PHPlot calculate the upperleft corner use:</p><pre class="programlisting">$plot->SetPlotAreaPixels(NULL, NULL, 600, 400);</pre><p>You do not have to specify both X and Y. The following example sets the rightedge of the plot area at X=600 and lets the other 3 edges be automaticallycalculated:</p><pre class="programlisting">$plot->SetPlotAreaPixels(NULL, NULL, 600);</pre><p></p></div><div class="refsect1"><a id="idp1378570580"></a><h2>History</h2><p>Through PHPlot-5.0.6, SetPlotAreaPixels required all 4 arguments bespecified and not be NULL. Starting with PHPlot-5.0.7, each X and Yparameter can either be specified or automatically calculated.</p><p>SetPlotAreaPixels and SetPlotAreaWorld can be called in either order.Through PHPlot-5.0.4 this was because SetPlotAreaPixels wouldreset the scale factors if <a class="xref" href="SetPlotAreaWorld.html" title="SetPlotAreaWorld"><span class="refentrytitle">SetPlotAreaWorld</span></a> was alreadycalled.Starting with PHPlot-5.0.5, both functions just store the information,and no calculations take place until <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> is used.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="SetPlotAreaBgImage.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="SetPlotAreaWorld.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">SetPlotAreaBgImage </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> SetPlotAreaWorld</td></tr></table></div></body></html>