Clear Filters
Clear Filters

dynamic capsule list color

1 view (last 30 days)
Alexander Maier
Alexander Maier on 24 Mar 2021
Commented: Alexander Maier on 28 Mar 2021
Hello,
I have a Program, which iterates multiple objects an n amount of steps into the future. For this I use the dynamic capsule list.
Finally there is a visualisation of the capsules with
show(capList, 'TimeStep',1:capList.MaxNumSteps,'FastUpdate',1, 'ShowCollision', true);
drawnow;
For visual purposes I would like the capsules to be displayed in different colors and maybe add some additional capsules in a certain color. How could I manually set the color in this case? Thank you in advance!

Accepted Answer

Adam Danz
Adam Danz on 24 Mar 2021
I'm not familiar with dynamicCapsuleList objects at all but played around with it a bit. The object colors are defined by patch objects burried in a series of hggroups and hgtransforms. The patch colors are in the CData or FaceColor properties of the patch objects.
I don't know whether the color can be specified as input properties but here's how to change color after the objects are rendered.
Get handles to all ObstacleListEgoGroups
OLEG = findobj(gca, 'Tag','ObstacleListEgoGroup');
Get handles to the patches within the group
ph = findobj(OLEG, 'Type', "Patch");
Set the color of the first patch obj to red
ph(1).FaceColor = 'r';
To set a transition of colors set FaceColor to 'flat' and define the CData values (see patch documentation).

More Answers (0)

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!