Change plot properties generated from a curve fitting

조회 수: 16 (최근 30일)
Very Determined
Very Determined 2019년 11월 15일
편집: Very Determined 2019년 11월 18일
Hello,
I am trying to remove the markers and change the line properties from a plot made by rational fit. I tried different options such as Marker, none and Linestyle but it did not work. I have event tried h.Marker='none' and no success. Any idea how to solve this?
[fitresult, gof] = fit( xData, yData, ft, opts );
% h = plot( fitresult, xData, yData, 'Linestyle', 'none','Color','k', 'Marker',marker_style{i} );
h = plot( fitresult, xData, yData);
h.Marker = 'none';
Thanks
  댓글 수: 3
Joe Vinciguerra
Joe Vinciguerra 2019년 11월 16일
I’m not at my computer right now, but can you access the properties you want from the property inspector dialog? Or are they within a "child" of h?
Very Determined
Very Determined 2019년 11월 18일
Yeah. You are right. Thanks

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

채택된 답변

Joe Vinciguerra
Joe Vinciguerra 2019년 11월 16일
Since the object contains 2 lines try calling them specifically. For example:
h(1).Marker='none'
h(2).Color=[.5 .5 .5]
  댓글 수: 2
Very Determined
Very Determined 2019년 11월 18일
편집: Very Determined 2019년 11월 18일
Thank you. This helps. However, I still see the lines and data in the legend. I am plotting 4 sets of data in a for loop, so I do not want to define specific handle for each plot to manipulating the legends. Could you help learn how to remove the line and 'fittted curve' from the legend? I waant to define legend later for markers ('data' here) so the text legend for markers should also be modified.
Capture.PNG
Very Determined
Very Determined 2019년 11월 18일
편집: Very Determined 2019년 11월 18일
OK. I figured out to fix this issue by defining the figure handles in the loop as a cell array.
h{k} = plot( fitresult, xData, yData);
h{k}(1).Marker = marker_style{i};
h{k}(2).Color=[.5 .5 .5];
and out of the loop
legend([h{1}(1) h{2}(1) h{3}(1) h{4}(1)], legends_text{1},legends_text{2},legends_text{3},legends_text{4},'AutoUpdate','off')

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by