How to change corrplot line and scatter dots properties?

4 vues (au cours des 30 derniers jours)
dila suay
dila suay le 1 Jan 2023
Commenté : dila suay le 3 Jan 2023
Hi Eveyone,
I would like to change the properties of corrplot, like linewidth or color of the dot. How can I do that?
Also, is there any way to save only 1 plot in corrplot?
Thank you

Réponse acceptée

Bora Eryilmaz
Bora Eryilmaz le 1 Jan 2023
Modifié(e) : Bora Eryilmaz le 2 Jan 2023
Get the handle of the plot out and modify the desired properties:
[~,~,h] = corrplot(rand(100,2))
h =
2×2 graphics array: Histogram Line Line Histogram
h(1,2)
ans =
Line with properties: Color: [0 0 1] LineStyle: 'none' LineWidth: 0.5000 Marker: 'o' MarkerSize: 2 MarkerFaceColor: 'none' XData: [0.7873 0.5984 0.1201 0.1410 0.0083 0.1620 0.1182 0.1570 0.2894 0.5865 0.7984 0.4431 0.4161 0.4538 0.1486 0.1437 0.5509 0.3145 0.3455 0.3906 0.1897 0.6107 0.6898 0.6438 0.1894 0.7857 0.7490 0.6415 0.6582 0.0314 0.0351 0.4634 … ] YData: [0.2229 0.0350 0.4146 0.1456 0.0748 0.7509 0.7659 0.5506 0.1790 0.0956 0.3297 0.8241 0.6540 0.7515 0.1818 0.0070 0.3617 0.7087 0.3328 0.4187 0.6542 0.4051 0.7642 0.8023 0.5341 0.5813 0.8490 0.2850 0.8221 0.7120 0.4635 0.3704 … ] Show all properties
h(1,2).Color = 'r';
h(1,2).MarkerSize = 4;
The regression line's handle can be found as:
h(1,2).Parent.Children
ans =
3×1 graphics array: Text (corrCoefs) Line (lsLines) Line
L = h(1,2).Parent.Children(2);
L.LineWidth = 3;
  4 commentaires
Bora Eryilmaz
Bora Eryilmaz le 2 Jan 2023
See updated answer.
dila suay
dila suay le 3 Jan 2023
Thank you so much

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Linear and Nonlinear Regression 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