How to flip a patch graph/diagram?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sina
el 15 de Dic. de 2015
Editada: Walter Roberson
el 18 de Dic. de 2015
Hey,
I want to flip a triangle I plotted with patch. See the picture for clarification.
I don't want anything else (e.g. axes) to be changed. Is there an easy way to do this?

0 comentarios
Respuesta aceptada
Walter Roberson
el 16 de Dic. de 2015
XL = get(gca, 'XLim');
patch_X = get(patch_handle, 'XData');
new_X = XL(2) - patch_X + XL(1);
set(patch_handle, 'XData', new_X);
You did not say which axis to flip it around, so I choose the middle of the displayed data rather than middle of the patch data or half of the patch data or around its right-most point.
4 comentarios
Walter Roberson
el 18 de Dic. de 2015
Editada: Walter Roberson
el 18 de Dic. de 2015
You could iterate through all of the patch handles.
for patch_handle = findobj(gca, 'type', 'patch')
...
end
If they are not all in the same axes then a slight be more work needs to be done in order to get the correct XLIM for the axes they are in.
Más respuestas (0)
Ver también
Categorías
Más información sobre Polygons en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!