How to change corrplot line and scatter dots properties?

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

 Akzeptierte Antwort

Bora Eryilmaz
Bora Eryilmaz am 1 Jan. 2023
Bearbeitet: Bora Eryilmaz am 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 Kommentare

Thank you so much.
However, I couldnt find the preoperties for regression line.Do you know how can I change that?
See updated answer.
Thank you so much

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Discrete Data Plots finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by