Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to draw Violin Picture by Matlab

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how Matlab draws violin pictures". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn this article "how to draw violin pictures in Matlab".

1 the basic use of the example, Y is the matrix Xuan 1, Hdl1=violinChart, [0 0.447 0.741], 6)

X: Abscissa

Y: dataset

FaceColor: color, example is [0 0.447 0.741]

Width: the width of the violin picture, which is 0.6, that is, the upper limit of the probability density is 0.6 times the distance between two violin pictures.

For basic use, Y is a vector, X is the tag X = [1.*ones (1Magi 50), 2.*ones (1Mague 30), 3.*ones (1Mague 20), 4.*ones (1Mague 50), 5.*ones (1Magazine 50)]; Y=randn (1200) + sin (X); Hdl=violinChart (gca,X,Y, [0 0.447 0.741])

Base on using multiple images and add legend X1 = [1 cos 2) + sin (X1); X2 drawing 2) + cos (X2); figureHdl1=violinChart (gca,X1,Y1, [0.447 0.741]); Hdl2=violinChart (gca,X2,Y2, [0.850 0.325 0.098]); legend ([Hdl1.F_legend,Hdl2.F_legend], {'randn+sin (x)', 'randn+cos (x)'})

2 complete code function Hdl=violinChart (ax,X,Y,FaceColor Width)% @ author slandarer% Hdl: returned graphic object handle structure% -% Hdl.F_density (I) | patch | Kernel density distribution% Hdl.F_outlier (I) | scatter | outliers % Hdl.F_range95 (I) | line | maximum and minimum after removing outliers% Hdl.F_quantile (I) | patch | quartile box% Hdl.F_medianLine (I) | line | median% Hdl.F_legend | patch | graphic object used to generate legend legend%- -% Please use the following method to generate the legend:% Hdl1=violinChart (ax ...)% Hdl2=violinChart (ax,X,Y,......)%...% legend ([Hdl1,Hdl2,......], {Name1,Name2) .})% = =% the following is the use example code:% -% X1 = [1 -% X1 = [1-1-2-7-13] % Y1=randn (100prime5) + sin (X1);% X2qing2 Y2=randn (100jing5) + cos (X2);% Hdl1=violinChart (gca,X1,Y1, [0.447 0.741], 0.5);% Hdl2=violinChart (gca,X2,Y2, [0.850 0.325 0.098], 0.5);% legend ([Hdl1.F_legend,Hdl2.F_legend], {'randn+sin (x)', 'randn+cos (x)'}); if nargin

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report