How to keep a patch object and its rotation in the same plot
30 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
GreenPiece
le 16 Fév 2019
Commenté : Walter Roberson
le 16 Fév 2019
How can I keep the two following objects in the same plot. I tried to use 'hold on' but I did not work. I think that the object is dissappeared after rotating but I could not find a solution. (I have read this: https://www.mathworks.com/matlabcentral/answers/328222-two-patches-in-one-figure. But it could not help)
bot = patch(x,y,'blue');
hold on
rotate(bot, [0 0 1], 45)
Thanks.
0 commentaires
Réponse acceptée
Star Strider
le 16 Fév 2019
Try this:
x = [1 2 2 1];
y = [1 1 2 2];
figure
bot = patch(x,y,'blue');
rotate(bot, [0 0 1], 45)
hold on
patch(x,y,'blue')
hold off
axis equal
You did not specify what your ‘x’ and ‘y’ are. This works with mine. It simply requires a second patch call.
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Polygons dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!