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.
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
= Absolute or
Layout = Relative in the
canvas and providing suitable values for
the scenes), this may be undesirable. Using
you can make the background of a scene transparent, so the canvas
background and scenes behind it are visible.
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=), 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
we an set this rectangle to transparent:
s2::BackgroundTransparent := TRUE: plot(s1, s2, Layout = Absolute, Width = 130, Height = 90)