This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Plot a scene on a transparent background

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Value Summary

InheritedFALSE, or TRUE

Graphics Primitives

ObjectsBackgroundTransparent Default Values
plot::Scene2d, plot::Scene3dFALSE


Using BackgroundTransparent, you can have a scene “without a background.”

By default, each scene has an opaque background. In the case of overlapping scenes (which you can achieve by setting Layout = Absolute or Layout = Relative in the canvas and providing suitable values for Bottom and Left for the scenes), this may be undesirable. Using BackgroundTransparent, you can make the background of a scene transparent, so the canvas background and scenes behind it are visible.

With BackgroundTransparent = TRUE, other background settings (BackgroundColor, BackgroundStyle, BackgroundColor2) are ignored.


Example 1

We create a number of random points and two statistical plots of this sample:

gen := stats::normalRandom(0, 1):
data := [gen() $ i = 1..1000]:
s1 := plot::Scene2d(plot::PointList2d([[i, data[i]]
                                       $ i = 1..1000]),
                    Left = 0, Bottom = 10,
                    Width = 120, Height = 80):
s2 := plot::Scene2d(plot::Histogram2d(data, Cells=[20]),
                    Left = 80, Bottom = 0,
                    Width = 50, Height = 40):
plot(s1, s2, Layout = Absolute, Width = 130, Height = 90)

The histogram plot obscures parts of the point list in a rectangle much larger than the bars of the histogram plot. Using BackgroundTransparent, we an set this rectangle to transparent:

s2::BackgroundTransparent := TRUE:
plot(s1, s2, Layout = Absolute, Width = 130, Height = 90)

See Also

MuPAD Functions

Was this topic helpful?