how can I plot the points the dataset in the boxplot
6 views (last 30 days)
Show older comments
Hello,
how can I plot the points the dataset in the boxplot? Same like the photo
my code is here
MPG = [-4.60517018600000;-4.60517018600000;-3.91202300500000;-3.50655789700000;-3.21887582500000;-3.21887582500000;-3.21887582500000;-2.99573227400000;-2.99573227400000;-2.99573227400000;-2.99573227400000;-2.81341071700000;-2.65926003700000;-2.52572864400000;-2.52572864400000;-2.52572864400000;-2.52572864400000;-2.52572864400000;-2.52572864400000;-2.52572864400000;-2.40794560900000;-2.40794560900000;-2.30258509300000;-2.30258509300000;-2.30258509300000;-2.30258509300000;-2.30258509300000;-2.30258509300000;-2.30258509300000;-2.12026353600000;-1.96611285600000;-1.96611285600000;-1.96611285600000;-1.77195684200000;-1.77195684200000;-1.71479842800000;-1.66073120700000;-1.60943791200000;-1.60943791200000;-1.60943791200000;-1.60943791200000;-1.60943791200000;-1.60943791200000;-1.60943791200000;-1.60943791200000;-1.60943791200000;-1.60943791200000;-1.60943791200000;-1.60943791200000;-1.60943791200000;-1.38629436100000;-1.30933332000000;-1.20397280400000;-1.20397280400000;-1.20397280400000;-1.20397280400000;-1.10866262500000;-0.916290732000000;-0.916290732000000;-0.916290732000000;-0.916290732000000;-0.916290732000000;-0.820980552000000;-0.776528789000000;-0.776528789000000;-0.713349888000000;-0.693147181000000;-0.693147181000000;-0.693147181000000;-0.693147181000000;-0.693147181000000;-0.693147181000000;-0.693147181000000;-0.634878272000000;-0.510825624000000;-0.510825624000000;-0.510825624000000;-0.446287103000000;-0.356674944000000;-0.356674944000000;-0.356674944000000;-0.356674944000000;-0.314710745000000;-0.223143551000000;-0.223143551000000;2.30258509300000;2.30258509300000;2.30258509300000;2.30258509300000;0.0468835860000000;0.0861776960000000;0.0953101800000000;0.120002792000000;0.182321557000000;0.262364264000000;0.262364264000000;0.262364264000000;0.298622012000000;0.300104592000000;0.336472237000000;0.336472237000000;0.470003629000000;0.470003629000000;0.530628251000000;0.588897159000000;0.601579987000000;0.693147181000000;0.693147181000000;0.767790724000000;0.791634127000000;0.819779831000000;0.855266030000000;0.916290732000000;0.924258902000000;0.945849534000000;0.955511445000000;0.955511445000000;0.993251773000000;1.02961941700000;1.13140211100000;1.16315081000000;1.25276296800000;1.25276296800000;1.33500106700000;1.33500106700000;1.37498060100000;1.38629436100000;1.38629436100000;1.40462531800000;1.43508452500000;1.49738840900000;1.56861591800000;1.60943791200000;1.67147330300000;1.79175946900000;1.79175946900000;1.80828877100000;1.87180217700000;1.94591014900000;2.07944154200000;2.07944154200000;2.23001440000000;2.31253542400000;2.42036812900000;2.48490665000000;2.48490665000000;2.48490665000000;2.48490665000000;2.61739583300000;2.63905733000000;2.70805020100000;2.70805020100000;2.70805020100000;2.70805020100000;2.77258872200000;2.77258872200000;2.77258872200000;2.83321334400000;2.83321334400000;2.86220088100000;2.91777073200000;2.94443897900000;2.97041446600000;2.97041446600000;2.99573227400000;2.99573227400000;2.99573227400000;2.99573227400000;2.99573227400000;2.99573227400000;3.00597959000000;3.04452243800000;3.04452243800000;3.13549421600000;3.15700042100000;3.17805383000000;3.18469837300000;3.25809653800000;3.25809653800000;3.33220451000000;3.33220451000000;3.36729583000000;3.36729583000000;3.40119738200000;3.43398720400000;3.43398720400000;3.43398720400000;3.44361809800000;3.46573590300000;3.46573590300000;3.49650756100000;3.49650756100000;3.49650756100000;3.49650756100000;3.52636052500000;3.55534806100000;3.55534806100000;3.61091791300000;3.78418963400000;3.80666249000000;3.89182029800000;3.89182029800000;3.93182563300000;3.95124371900000;3.97029191400000;3.97164948200000;3.98898404700000;3.98898404700000;4.09434456200000;4.14313472600000;4.18965474200000;4.44265125600000;4.55387689200000;4.57471097900000;4.57471097900000;4.60517018600000;4.63472898800000;4.68213122700000;4.69134788200000;4.70048036600000;4.75359019100000;4.76217393500000;4.77068462400000;4.78749174300000;4.80402104500000;4.82831373700000;4.82831373700000;4.84418708600000;4.90527477800000;4.90527477800000;4.91265488600000;4.96981330000000;5.00394630600000;5.01063529400000;5.04342511700000;5.12989871500000;5.14166355700000;5.21493575800000;5.22035582500000;3.11351530900000;3.13983261800000;3.27336401000000;3.27714473300000;3.44998754600000;3.51749783700000;3.60004824000000;3.63495111200000;3.65065824100000;3.78872478900000;4.01277290900000;4.04480411700000;4.08597631300000;4.18661983800000;4.21508618000000;4.32941668400000;4.57985237800000;4.95229971700000;5.29831736700000;3.65221547000000];
str = {'Germany',
'Germany',
'Portugal',
'Spain',
'Italy',
'Italy',
'Spain',
'Portugal',
'Greece',
'Italy',
'Greece',
'Germany',
'Netherlands',
'UK',
'Greece',
'Italy',
'Italy',
'Greece',
'Greece',
'Italy',
'Spain',
'Italy',
'France',
'Italy',
'France',
'France',
'Italy',
'Spain',
'Germany',
'Netherlands',
'Greece',
'Greece',
'UK',
'Greece',
'Spain',
'Spain',
'France',
'Italy',
'Germany',
'Greece',
'Spain',
'Greece',
'Greece',
'Italy',
'Italy',
'Croatia',
'Italy',
'Italy',
'Croatia',
'Greece',
'Greece',
'Italy',
'Greece',
'Croatia',
'Italy',
'Portugal',
'Spain',
'Portugal',
'Italy',
'Greece',
'Moldova',
'France',
'Hungary',
'Moldova',
'Portugal',
'Spain',
'Moldova',
'Italy',
'Moldova',
'Moldova',
'France',
'Moldova',
'Spain',
'France',
'Moldova',
'Italy',
'Italy',
'Moldova',
'Spain',
'Spain',
'Moldova',
'Italy',
'Moldova',
'Moldova',
'Italy',
'Portugal',
'Spain',
'Italy',
'Spain',
'Spain',
'France',
'France',
'France',
'Spain',
'Spain',
'Hungary',
'Spain',
'Italy',
'Spain',
'Spain',
'Italy',
'Spain',
'Greece',
'Hungary',
'Italy',
'Italy',
'Hungary',
'Portugal',
'Hungary',
'Croatia',
'Italy',
'Spain',
'Spain',
'Croatia',
'Italy',
'Portugal',
'Italy',
'Spain',
'France',
'Croatia',
'Spain',
'France',
'Spain',
'Italy',
'Italy',
'Greece',
'Croatia',
'Spain',
'Spain',
'Italy',
'Italy',
'Spain',
'Spain',
'Spain',
'Croatia',
'Italy',
'Italy'};
MPG = rand(length(str), 1);
boxplot(MPG,str)
2 Comments
Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!