Problem with Flat Boxplots (Height)
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi! I need help for a little problem concerning boxplots. I'm trying to draw a boxplot for each column of this matrix:
0,611811812025304 NaN NaN
0,202012002233165 NaN NaN
0,121618028406950 NaN NaN
0,237524917985388 NaN NaN
0,422843308928793 NaN NaN
1,34805765717167 NaN NaN
0,407175451160424 NaN NaN
0,181795622494409 NaN NaN
0,872365832050369 NaN NaN
0,400678297953037 NaN NaN
0,460260710072307 NaN NaN
8,39873881367597 NaN NaN
0,606103338545742 NaN NaN
4,03831386379199 NaN NaN
1,36753038819243 NaN NaN
0,953634332672089 NaN NaN
0,141486467642448 NaN NaN
0,161911818419999 NaN NaN
2,17059425768484 NaN NaN
2,36664942803871 NaN NaN
2,53445480253044 NaN NaN
0,586500894555781 NaN NaN
1,54852352420527 NaN NaN
0,822402150988892 NaN NaN
0,128866124032608 NaN NaN
1,61899736876937 NaN NaN
1,31257864637621 NaN NaN
0,413476666915168 NaN NaN
0,353846288130247 NaN NaN
19,9164007184726 0,422522449090564 NaN
0,821951799072535 0,220331707234890 NaN
0,174829883747978 0,109043770014573 NaN
0,215984225044525 1,31248161051824 NaN
0,132624070899366 0,197591729850422 NaN
0,715060420607512 3,66411237140579 NaN
37,9756265539746 0,804492414052763 NaN
8,04621953389878 0,0835547017967292 NaN
62,1120347049725 1,85195846002136 NaN
0,527662025334865 0,431617889581757 NaN
5,05616171189133 0,154725905026987 NaN
6,09471077005657 19,2419162458918 NaN
1,05486253006966 0,775569626694653 NaN
1,77178376126561 0,294098924340488 NaN
76,8371633535447 0,170044560105851 NaN
0,262779856773621 10,6814671826124 NaN
6,34644533636596 0,222503274615019 NaN
0,398416944949906 0,258014846445284 NaN
0,541844064501460 1,60942779392956 NaN
1,13470266392566 4,45138332454159 NaN
0,311461585919655 0,509602957109919 NaN
0,736529543160809 0,180008207054924 NaN
0,215755150652812 0,598259260691424 NaN
0,658629847496683 0,179944924813846 NaN
3,12837015223708 1,23091286452402 NaN
17,1335986354163 0,305671121564177 NaN
55,3852855457813 0,274408034191056 NaN
0,947944849082426 2,84755681934467 NaN
1,26062073438588 0,682251600465320 NaN
14,8476598061371 4,30272663391816 NaN
0,335844703911900 1,04861419042058 NaN
5,75548455284785 1,12551791503430 NaN
0,345652067777950 1,49822450824455 NaN
9,81009098287847 0,676215562928618 NaN
2,68166082688514 1,23419161559456 NaN
0,251874526656245 12,4891194259660 NaN
2,99452626964836 2,59000896049364 NaN
1,96910272158643 3,82744629504532 NaN
23,9075399036276 0,240756274962680 NaN
0,445934742111256 2,69444721151977 NaN
0,0879075935922513 0,480390983790141 NaN
0,495895273705287 1,72850466210875 NaN
1,51920977118476 1,37019601640097 NaN
0,602591322238240 2,27173295273887 NaN
2,65016320831140 0,399306647283119 NaN
0,652919404656894 3,74784519948607 NaN
12,6636090880146 0,0453071186558230 NaN
31,7217052541265 0,959766702816410 NaN
0,932555998968833 2,24323371331513 NaN
0,574549599692967 0,0596835687308849 NaN
0,169795126370524 0,357063248105366 NaN
2,49952957587646 0,391616942075280 NaN
0,922328839293043 0,389099393998163 NaN
5,88431094473470 0,880863618935896 NaN
0,666373866087364 0,806129610025604 NaN
0,289110414109209 0,273296486342186 NaN
37,1372317864379 1,59916163168910 NaN
1,00399924776550 0,510404010539926 NaN
0,104415494057556 1,12535953418473 NaN
0,392168208154147 1,53352272352835 NaN
0,353195194949214 0,0638678812707424 NaN
1,65665838149233 0,465284527044651 NaN
0,407250835385937 1,43508698785990 NaN
25,2095009950367 333,458019738854 NaN
1,85521610411371 0,216399902105888 NaN
1,67215937780101 0,0465556138038966 NaN
2,50139935019729 0,330303879161160 NaN
16,9210477222438 2,25442899748870 NaN
0,108902911160233 1,01476955773043 NaN
0,285617177287497 0,355967087977850 NaN
0,0341936150247026 0,0942703964200585 NaN
52,2577945933913 0,719781498162715 NaN
0,0405834697865815 0,648447533429696 NaN
0,143978326584961 0,325906605184672 NaN
0,527529494811141 0,822849257847561 NaN
0,652697261435919 0,00263785304909766 NaN
0,586422176736425 2,23005636992619 NaN
4,20352160384643 33,6542983565242 NaN
1,39512312649093 3,03987274382649 NaN
0,219994166838996 2,03982910484300 NaN
10,1692748849028 0,0302461766890810 NaN
0,388498043776487 0,785475077490126 NaN
5,26350495914151 0,189247891011270 NaN
1906,03927674280 0,918401577958579 NaN
0,331353936654492 1,63277244005074 NaN
0,202452639682081 0,377153183542493 NaN
0,248792380035754 0,862012949125239 NaN
0,144058865750009 1,25594145603608 NaN
0,434251033937157 0,810081886927791 NaN
3,37853436605957 0,414531045492129 NaN
0,727301185322304 0,476504229495548 NaN
0,197237521214282 0,709467137164667 NaN
4,75011700302277 6,81872288106616 NaN
25,2390478012556 0,744903841635965 NaN
16,9054774733034 1,10790534950496 NaN
0,0778823656329089 0,606540914375345 NaN
3,28051400188373 1,14429027967013 NaN
1,55052769970343 2,76138142125145 NaN
116,136763025906 0,459868364331018 NaN
0,455767171342352 0,0269992560452722 0,108477959266486
14,3877215775941 4,02660150717863 0,580618593817879
1,30058050949341 167,482231797116 0,109967555854390
0,917949582829439 1,96001982822263 0,657385060568056
0,907566734216333 0,328046673063935 0,186265014929369
4,07517329715105 2,16459933566971 1,48105447232745
5,89372508366354 4,27673888332093 0,145926788783252
1,17243130736479 2,09482619639844 2,05139562859070
0,150431893777696 4,12520498464090 1,16672568163949
1,27127321111770 0,249209655582009 0,551352741345712
0,421515007134110 0,813236871384940 6,93595108199714
2,39776839934303 21,7233201600435 0,224599930151125
3,23163317706398 1,08391432192602 0,0375514422352337
0,280183053311817 0,389555215732463 0,666250151564336
0,557136642154887 1,74024452149903 0,215507695972955
0,581095819685200 0,0602910798188294 2,14035599403875
0,902606066380205 0,543779008208623 0,668593262023713
2,84667877076861 0,0824001253545941 2,78532443234326
0,474272341996740 0,490666675987195 58,3743050253014
17,6589568584233 1,82629473679662 12,0949341817428
4,51843087637085 0,559198911464602 19,7433084438693
0,286942399893278 0,799615601479297 38,2516683910076
0,0635411640388297 0,933168819705902 62,0323888759710
0,373770135823154 7,63160924593722 3,36880920960204
0,563547852405034 3,68150603426219 0,0844051475750177
0,563763718691636 0,0858077433835352 2,45028563543351
0,779552515162068 1,22315362811170 0,678039626325907
7,82373898608818 9,99535926564456 0,176492746852374
3,11942262000012 0,702810142190048 0,0756689516764759
0,781279512824197 0,0831345789614009 1,46972691941447
1,78208880662340 0,745959059811934 1,18651049070498
2,21848413658943 0,115866176117972 0,804979261195900
1,21345604403708 1,62858356641623 2,41580365700995
1,64644841106322 1,78179443729634 8,88767783141012
0,866359534441569 2,68929960486374 1,70843950960183
1,65142606738816 1,96981177600291 9,83702182737424
3,24656232543207 0,206836574377629 2,87778276347558
1,56757280883254 5,35106858203508 1,58184057455379
1,13803487923058 20,9302010940674 1,29797674401709
0,537073372958349 0,352625874880865 0,557473446682534
0,101268495490836 0,255114887300310 0,620754248879394
0,169732961095946 0,480591406706194 0,531899464302346
3,95353169833155 0,181757764639465 0,0676101361048398
0,628911193190644 5,07640286243587 1,33427492167882
8,34266300258284 0,787008795332508 1,74339506641752
0,241551417112647 0,348954306984497 0,261139991961441
0,394989356707522 2,32569753764232 74,2557408010191
3,97629154977883 4,21453165827416 0,803558409300759
4,73713124292154 1,62087473984893 0,208091911978794
1,43684059663986 0,201979954621152 0,978437731776309
0,357776891903100 0,171357526531867 1,36250343378713
0,343472087499293 0,238167798496773 1,38553113234027
23,4826052809145 0,0577722909160037 1,33278007099429
0,479185255512544 0,410992491184793 3,42361567370143
1,29094718535058 0,116956701267027 0,328210754855321
0,912047740693493 2,26672064038048 2,39906776515951
0,880638449665181 0,199189755717506 22,1356580707882
0,356269197116918 0,439941803460157 0,435971423557942
3,36915231819955 1,96819973668821 6,60631969775426
0,118708730997220 2,65103656865232 0,267134368761076
0,144495091427304 0,293748408826842 7,12625186996259
2,70315356299488 0,385466511817921 1,79667136405767
0,409883794505140 0,466725611629881 0,0969082504124401
1,57195592669153 0,643103493531410 8,14396357908239
0,802482807472588 0,123248809258017 1,77394443302385
1,65553063610964 0,581028469932234 0,480106523373763
0,675613230098678 2,72379433822909 5,40506759023240
0,293441290289647 8,70701348375728 0,208341628400055
1,33958529483061 23,3850824619601 0,718198674715083
0,450626370633081 1,39268623785671 0,712788119554715
3,08900992439309 4,99982779973861 0,523741599431052
0,158662208958495 0,146821367890122 0,763979090005738
0,295988133413464 0,173795795808288 1,66291950201127
0,922017633136439 2,21691238284418 1,12792380826903
1,86238923403107 0,0762825556010607 0,491601515010430
18,0274937762162 0,291480897972595 13,1989384183348
0,330069951421628 1,48827380449194 3,71634874689128
0,0252990135485904 0,586104492388254 3,05559942555915
1,11612364407442 0,137824685169174 1,80117681228964
0,670598579421409 1,32761810062705 0,145430562683680
0,751095711556071 0,276332177656771 4,69238553086906
3,96756723799240 0,314019702887346 0,593045172932841
0,204978435727257 0,208242999011504 0,578988330716101
1,35246394712653 31,1998950104185 1,28669178943098
0,653381710864904 0,691611082115290 0,361612670677013
3,24250603344809 1,00533460010805 1,12812764185352
5,66346563841242 1,28434561942083 0,844991589980579
0,133445794251030 0,484108927269186 0,706772020799121
0,0961723467572176 1,36243735147102 3,91772817517976
0,220438340174641 0,234608471815911 2,33230152259361
0,732200176929252 0,455211478964844 0,132579883523120
0,606558509369120 43,2599958505976 0,690370550127751
2,87359734798277 0,351428436424998 0,419749775819546
1,81450232735005 6,65455309622865 2,16351906740400
3,58189071237147 0,435839901189409 0,363232837143702
2,09872798627613 3,35229219306922 1,01086210051098
27,0400417894414 1,11269434573208 0,898991073163114
8,41447311721747 0,116669929459443 0,351041330254094
18,5188230998014 0,849367217994179 0,108398076473373
0,130132960084386 5,48402293287256 1,57276810504462
67,0307317599186 1,16499120704080 0,0287235024061312
3,06403657220549 5,68652235769979 1,99853971602729
0,0612193919983093 1,32477083043251 44,2793732703085
0,477022914759577 8,48488944218403 0,978163259223186
0,350457765692137 0,544564562108746 0,519084244554332
0,456937915344642 0,583380758907430 3,02571174415551
0,405426435244366 0,751889866489825 0,511221033646454
31,8788766823986 7,87373704787610 14,2293180752816
0,501063368897439 3,02272328499824 0,234580448750740
2,42956890216784 0,921982575312160 0,725393774953451
1,25913721816711 0,126118232007005 9,20261166156716
32,1220486552959 5,47472300011537 0,321716081841228
1,16357040080161 2,60582053175120 0,348507697024575
0,975609629164045 3,62676528718201 15,5679968609625
30,5483775362479 0,208326133880049 0,851270626885559
Each column correspond to a year: [2010 2011 2012], so:
boxplot(myAx,myMatrix,[2010 2011 2012],'Notch','on','Symbol','k.');
Plot is being created but there is a big problem:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166554/image.png)
The data spread is too wide and the boxplots are flattened soo much that they become flat. Is there any way to solve this issue?
0 comentarios
Respuestas (1)
the cyclist
el 5 de Ag. de 2017
Editada: the cyclist
el 5 de Ag. de 2017
There are (at least) three straightforward solutions.
First, you could just limit the extent of the y-axis:
ylim([0 10])
Second, you could plot the y-axis on a log scale:
set(myAx,'YScale','log')
Third, you could just plot log(myMatrix):
boxplot(myAx,log(myMatrix),[2010 2011 2012],'Notch','on','Symbol','k.');
or
boxplot(myAx,log10(myMatrix),[2010 2011 2012],'Notch','on','Symbol','k.');
These have advantages and disadvantages. In first case, you don't plot the very large outliers. This may or may not be OK, depending on what you are trying to convey. You could add some kind of annotation to plot to indicate this.
In the second and third cases, it might be misleading to show your data a log scale. Again, it depends on what you are trying to convey.
1 comentario
the cyclist
el 5 de Ag. de 2017
Comment from Tommaso moved here from an "answer":
Both solutions are working fine. But I can't chose the best one. The data I'm plotting represents annual losses. If I chose the first solution, I lost the outliers but it's not a tragedy because other plots are already showing minimum/maximum values. If I chose the other solutions, Y axis becomes meaningless.
Ver también
Categorías
Más información sobre Grid Lines, Tick Values, and Labels en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!