本周文件交换选择

我们最好的用户反馈

备选箱形图

肖恩他本周的选择是备选箱形图通过克里斯托弗Hummersone

背景

我最近为一些MATLAB用户做了一个研讨会我展示的其中一个图是箱线图.利用箱形图可以快速了解一些能量数据在一天中不同时间的分布情况。下面就是:

数字箱线图(功率,小时,“缺口”“上”)包含(“一天中的一小时”) ylabel (“权力(MW)”

这幅图里有很多信息。晶须是除去异常值的极限也就是红色的+s。方框代表第25百分位和第75百分位,红线代表中位数,凹槽告诉你如果两个中位数没有重叠,它们是否有显著差异。

一位观众后来问我,是否有办法控制框的限制为任意百分比,他们想要10%和90%。我搜索了参数-值对,但没有找到任何东西。

进入另类盒子图!

备选箱形图提供了许多与MATLAB箱形图相同的选项,但也提供了更多的选项,百分位数就是其中之一。

Christopher将他的工具放在一个包中,这可以很好地避免与其他函数的命名冲突。我将进口该包使用的短名称:

进口iosr.statistics。*y = tab2box(小时,功率);%的重塑是boxPlot兼容bp = boxPlot(0:23,y,“缺口”,真的,“百分比”[90]);

非常好!

您可能还注意到我抓取了一个输出参数。这允许我自定义盒状图与简单的制表完成后,它已经完成。

英国石油公司。lineColor =“b”;英国石油公司。medianColor =“r”

事实上,我甚至可以通过添加额外的1来得到所有的4个百分位。

bp = boxPlot(0:23,y,“缺口”,真正的);英国石油公司。addPrctiles = [10 90];英国石油公司。addPrctilesColors = {“r”“b”
bp = boxPlot with properties: addPrctiles: [10 90] addPrctilesColors: {2×1 cell} addPrctilesLabels: {2×1 cell} addPrctilesMarkers: {2×1 cell} addPrctilesTxtSize: [] boxAlpha: 1 boxColor: {'none'} boxWidth: 'auto' groupLabelFontSize: 9 groupLabelHeight: 'auto' groupLabels: {1×0 cell} groupWidth: 0.7500 limit: '1.5IQR' lineColor: {'k'} lineStyle: {'-'} lineWidth: 1 meanColor: {[0 0.4470 0.7410]} meanMarker: {'+'} meanSize: 6 medianColor: {[0 0.4470 0.7410]} method: 'R-5' notch: 1 notchDepth:0.4000 notchLineColor: {'k'} notchLineStyle: {':'} notchLine: 0 outlierSize: 36 percent: [25 75] sampleFontSize: 9 sampleSize: 0 scaleWidth: 0 scatterAlpha: 1 scatterColor: {[0.5000 0.5000 0.5000]} scatterLayer: 'top' scatterMarker: {'x'} scatterSize: 36 showLegend: 0 showMean: 0 showOutliers: 1 showScatter: 0 style: 'normal' symbolColor: {[0 0.4470 0.7410]} symbolMarker: {'o'} theme: 'default' xSeparator: 0 xSpacing: 'x' handles: [1×1 struct] x: [1×24 double] y: [334×24 double] weights:[334×24 double]统计:[1×1 struct]

评论

试一试,让我们知道你的想法在这里或者留下评论克里斯托弗。




发布与MATLAB®R2016b

|
  • 打印
  • 发送电子邮件

评论

如欲留言,请点击在这里登录您的MathWorks帐户或创建一个新帐户。