필터 지우기
필터 지우기

Change marker size of few selected points (not all) of an already saved figure in MATLAB property editor

조회 수: 11 (최근 30일)
I have a matlab saved figure (.fig), which has some discrete points with black solid squre as marker. It also has a continuous line plot. I want to change the marker style from the existing black solid squre to cross mark (x) for some specific points only ( say, the 2nd point but Not all the discrete points). How to do this in MATLAB property editor for figure, without rewriting and again running the code. I am attaching my .fig file (named kkb.fig). There 2 discrete points for which the marker style need to be modified (existing black solid squre to cross mark (x)) are marked with red circle. Can help me regarding this.

채택된 답변

Cris LaPierre
Cris LaPierre 2018년 12월 18일
편집: Cris LaPierre 2018년 12월 18일
I don't think it's possible to edit just a couple points in a series using the property inspector.
There is a way to do this programmatically without rewriting/rerunning your code.
Open your figure
Get a handle to your scatter plot
h = findobj(gca,'Type','Scatter');
Now extract the current X, Y data
X = h.XData;
Y = h.YData;
Now that you have the data, it's just a simple matter of manipulating it.
xCross = X([2 end]);
yCross = Y([2 end]);
h.XData([2 end]) = [];
h.YData([2 end]) = [];
hold on
plot(xCross,yCross,'kx','MarkerSize',10)
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 12월 18일
Another approach in newer MATLAB is to
X = h.XData;
Y = h.YData;
hold on
plot(X, Y, 'kx', 'MarkerSize', 10, 'MarkerIndices', 2:length(X)-1)
Markers are only plotted at the relative offsets selected by MarkerIndices.
To emphasize, though: for any one primitive chart line object, it is only possible to have one marker variety (combination of shape, edge color, face color, marker size).
On the other hand, any one scatter object can have different face color and marker size per point, but must all have the same shape and edge color configuration.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by