SetPlotAreaBgImage — Set a graphic file to be used in the plot area background


$plot->SetPlotAreaBgImage($input_file, [$mode])


SetPlotAreaBgImage sets an image file to be used as the plot area background. The image can be scaled or tiled to fit.



Path to the file to be used. The file can be any type allowed by GD, which usually includes JPEG, GIF, and PNG.


Optional display mode for the background image: one of the strings 'centeredtile', 'tile', or 'scale'. The default is 'tile'.


If a background image has been set, background color (set with SetPlotBgColor) is ignored.

Scale mode scales the supplied background image file to fit the plot area. Tile and centeredtile modes repeat the supplied background image file as needed to fit the plot area. The difference is that centeredtile offsets the start position within the background image by half its size, which works better for some images.

SetPlotAreaBgImage sets a background for the plot area, while SetBgImage sets a background for the entire image area. If both are used, the plot area background overlays that portion of the overall background.

If $input_file is NULL, no background image will be used for the plot area.

If you are going to use a JPEG file for the plot area background, you should be using a truecolor PHPlot image. Truecolor images do not have a limited-size color map like palette images (which PHPlot uses by default). If you use palette image with a JPEG background, the background will likely overflow your image's color map and leave no free color slots for PHPlot to use for plot elements. The same is true if using a 24-bit color (non-mapped) PNG file for a background if it has many colors. For more on truecolor PHPlot images, see Section 4.3, “Truecolor Images”. Logo

This version of the manual was produced for the PHPlot Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the PHPlot project downloads area.