Effacer les filtres
Effacer les filtres

Change plot properties generated from a curve fitting

23 vues (au cours des 30 derniers jours)
Very Determined
Very Determined le 15 Nov 2019
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 commentaires
Joe Vinciguerra
Joe Vinciguerra le 16 Nov 2019
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 le 18 Nov 2019
Yeah. You are right. Thanks

Connectez-vous pour commenter.

Réponse acceptée

Joe Vinciguerra
Joe Vinciguerra le 16 Nov 2019
Since the object contains 2 lines try calling them specifically. For example:
h(1).Marker='none'
h(2).Color=[.5 .5 .5]
  2 commentaires
Very Determined
Very Determined le 18 Nov 2019
Modifié(e) : Very Determined le 18 Nov 2019
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 le 18 Nov 2019
Modifié(e) : Very Determined le 18 Nov 2019
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')

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Fit Postprocessing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by