Iterative plotting with symbol change

조회 수: 6 (최근 30일)
Alice
Alice 2014년 10월 23일
댓글: Ced 2014년 10월 24일
Hi,
I'm trying to do iterative plotting with each plot using a different symbol. The positions don't change, I just need to make the symbols change with each iteration. Any suggestions? Thanks
  댓글 수: 1
Ced
Ced 2014년 10월 23일
what do you mean by "the positions don't change, [...] make the symbols change"? So you have a plot, which does not change, but you want the colors/markers to change?
Generally speaking, you can either simply replot your data points using the new desired colors/markers, or you can use get/set to change any values/colors/markers etc. you like. The general formulation would be something like
handle = plot(x,y);
% then change whatever you like
set(handle,'option_name',value)
you can get a list of the available options by typing "get(handle)" (where handle is your actual plot handle).

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

채택된 답변

Adam
Adam 2014년 10월 23일
You can change the marker type for a plot in a loop if that is what you mean, though there are only 14 pre-defined ones so far as I can see.
e.g.
figure; h = plot( 1:100, rand(100,1) ); hold on
availableMarkers = set( h, 'Marker' );
for i = 1:numel( availableMarkers )
hPlot = plot( 1:100, rand(100,1) );
hPlot.Marker = possibleMarkers{i};
end
That isn't the most efficient code, but it can be tidied up. I initially read your question as you wanting to change the marker on the same plot over and over so adapted the code I wrote for that to use for a new plot each time instead!
  댓글 수: 2
Alice
Alice 2014년 10월 24일
Is there any way of making these markers letters and then having the letters change on each iteration?
Ced
Ced 2014년 10월 24일
I don't think this is possible by defaults (apart from the standard letters x, o, etc.). However, I found this on Matlab Central http://www.mathworks.ch/matlabcentral/fileexchange/39487-custom-marker-plot
There are also several threads on "custom markers" if you google it.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by