SetMarginsPixels
Prev | PHPlot Function Reference | Next

## SetMarginsPixels

SetMarginsPixels — Set margins around the plot area

## Synopsis

    $plot->SetMarginsPixels([$lm], [$rm], [$tm], [$bm])

## Description

`SetMarginsPixels` sets the size of the margins around the plot area. By default, the margin sizes are automatically calculated based on the space needed. Use SetMarginsPixels to override these automatic calculations and set specific margin sizes. The four margins are specified independently and in pixels.

## Parameters

`$lm`

  Optional argument specifying the left margin, in pixels. If omitted or NULL, the value is automatically calculated.

`$rm`

  Optional argument specifying the right margin, in pixels. If omitted or NULL, the value is automatically calculated.

`$tm`

  Optional argument specifying the top margin, in pixels. If omitted or NULL, the value is automatically calculated.

`$bm`

  Optional argument specifying the bottom margin, in pixels. If omitted or NULL, the value is automatically calculated.

## Notes

The plot area is equal to the image area minus the margins. By default, the margins are automatically calculated based on the space needed for items outside the plot area. The plot area is then whatever space remains. Calculation for most plot types takes into account the main title, axis titles, tick or data labels, and tick marks (but not the legend, if drawn). For pie charts, only the main title size is used when calculating the needed margins. Use SetMarginsPixels to override these automatic calculations and control the margins.

The upper left corner of the plot area is at device coordinates (Left_Margin, Top_Margin). The lower right corner of the plot area is at device coordinates (Image_Width - Right_Margin, Image_Height - Bottom_Margin).

SetMarginsPixels and SetPlotAreaPixels perform the same function with different semantics. It makes no sense to use both - only the last one called will have an effect.

Trailing defaulted arguments can be omitted, but non-trailing defaulted arguments must be specified as NULL. For example, to set the right margin to 100 pixels, and let PHPlot calculate the other three margins, use:

    $plot->SetMarginsPixels(NULL, 100);

## History

Through PHPlot-5.0.6, SetMarginsPixels required all 4 arguments be specified and not be NULL. Starting with PHPlot-5.0.7, each margin can either be specified or automatically calculated.

Prev | Up | Next
SetLineWidths | Home | SetNumberFormat