Documentation

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.

Groups of Primitives

An arbitrary number of graphical primitives in 2D or 3D can be collected in groups of type plot::Group2d or plot::Group3d, respectively. This is useful for inheriting attribute values to all elements in a group.

In the following example, we visualize random generators with different distributions by using them to position random points:

r1 := stats::normalRandom(0, 1):
group1 := plot::Group2d(plot::Point2d(r1(), r1()) $ i = 1..200): 
r2 := stats::uniformRandom(-3, 3):
group2 := plot::Group2d(plot::Point2d(r2(), r2()) $ i = 1..500): 
plot(group1, group2, Axes = Frame):

We cannot distinguish between the two kinds of points. Due to the grouping, it is very easy to change their color and size by setting the appropriate attributes in the groups. Now, the two kinds of points can be distinguished easily:

group1::PointColor := RGB::Red:
group1::PointSize := 1.5*unit::mm:
group2::PointColor := RGB::Blue:
group2::PointSize := 1.3*unit::mm:
plot(group1, group2, Axes = Frame):

Was this topic helpful?