how to add a STAR or Triangle shape to plot simply without knowing their vertex?

Hi
I have a contourf. I'd like to just add a simple Star or Triangular shape to certian location within the plot. I am thinking to use Patch() but patch still requires to provide the vertext of this Star or triangular shape in order to draw it. Is there a command to add this shape without knowing their vertex? Thanks

 Respuesta aceptada

Jonas
Jonas el 15 de Jul. de 2021
Editada: Jonas el 15 de Jul. de 2021
smth. like that probably
Z = peaks;
contourf(Z); hold on;
plot(15,10,'rp','MarkerSize',15,'MarkerFaceColor','r')
all markers can be found here, there are also triangles and hexagonal stars

3 comentarios

roudan
roudan el 15 de Jul. de 2021
Editada: roudan el 15 de Jul. de 2021
Thanks Jonas. It works perfectly. I appreciate your help. It saved me a lot of time. Now another question, how do I delete this shape later? I am creating a array to save the handle of the shape, then later using delete(handle) and the error says Cannot access method 'delete' in class 'matlab.ui.Root'. I found the data saved in the handle array is not a handle and it is just a number. Thanks for your help.
hi roudan, you can show your code how you saved your handles. the following worked for me without problems:
Z = peaks;
contourf(Z); hold on;
mark=plot(15,10,'rp','MarkerSize',15,'MarkerFaceColor','r');
delete(mark)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Versión

R2020a

Preguntada:

el 15 de Jul. de 2021

Comentada:

el 16 de Jul. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by