Marker-related line properties in annotations

조회 수: 5 (최근 30일)
LR
LR 2019년 6월 19일
답변: LR 2019년 6월 19일
Hi folks,
Simple problem here: I am creating a line object outside a figure's axes using the annotation function.
I need the line object to exhibit circles at each data point, just like the following would do:
line([x1 x2],[y1 y2],'color','k','marker','o')
This works because line objects do have a marker property (and related properties like markersize, markeredgecolor, markerfacecolor)
However, when creating the same line object with the annotations function, like this:
annotation('line',phi1([x1 x2]),phi2([y1 y2]),'color','k','marker','o')
(where phi1 and phi2 are two functions that transform the x and y coordinates to fit in the axes of the figure)
I get the following error message:
---------------
Error using matlab.graphics.shape.Line/set
There is no Marker property on the Line class.
---------------
What is going on? I tried fiddling around with the handles to the annotation, with no success.
  댓글 수: 1
LR
LR 2019년 6월 19일
편집: LR 2019년 6월 19일
The documentation of annotation does not mention the specific properties that can be modified for line objects, however, it does specify that the annotation function can be used as follows:
annotation(...,'PropertyName','PropertyValue',...)

댓글을 달려면 로그인하십시오.

채택된 답변

LR
LR 2019년 6월 19일
It appears that the annotation function does not support the marker-related properties for the Line class, or the curvature property for the Rectangle class, etc.
One workaround to display objects outside the axes and modify their marker properties is to set the 'Clipping' property of the object to 'off':
line([x1 x2],[y1 y2],'color','k','marker','o','Clipping','off')
where x1, x2, y1, y2 are the coordinates of the line object given in the current axis.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by