버전 (14.1 KB) 작성자: Kelly Kearney
An alternative boxplot function
다운로드 수: 3.9K
업데이트 날짜: 2021/9/23

boxplot2.m: Alternative Matlab boxplots

Author: Kelly Kearney View boxplot2 on File Exchange

This repository includes the code for the boxplot2.m Matlab function, along with all dependent functions required to run it. This function is intended as an alternative to the boxplot.m function that is included in the Statistics and Machine Learning Toolbox.

The original boxplot.m function is more heavy-handed than most Matlab plotting functions; it replaces ticks with text labels, changes axis dimensions, etc. This version creates a boxplot with a minimal amount of alteration to existing axes, assuming that any cosmetic changes (color, tick labels, line specs, etc) can be added by the user afterwards if necessary.

Additionally, this function allows one to create clustered boxplots, similar to an unstacked bar graph. See below for an example.

Getting Started


This software requires Matlab (tested primarily on R2012a-R2016a), as well as the Statistics and Machine Learning Toolbox.


Git users can clone (or fork, then clone) directly from this repository.

Alternatively, you may download a zipped version of this code either from this page or from the boxplot2.m entry on the MatlabCentral FileExchange. The File Exchange entry is updated daily from this repository.


Once downloaded (and unzipped, if necessary), all subfolders in the main folder need to be added to your Matlab path:

% Replace with location of the downloaded folder
pth = './boxplot2-pkg/';

addpath(fullfile(pth, 'boxplot2'); 
addpath(fullfile(pth, 'minmax'); 



h = boxplot2(y)
h = boxplot2(y,x)
h = boxplot2(..., p1, v1, ...)

See standard function headers (accessed via doc or help) for a full description of input and output variables.


This example demonstrates how to create a simple grouped boxplot, and then to change some of the cosmetic details:

% Data

x = 1:5;
y = randn(5, 3, 100);

% Plot boxplots

h = boxplot2(y,x);

% Alter linestyle and color

cmap = get(0, 'defaultaxescolororder');
for ii = 1:3
    structfun(@(x) set(x(ii,:), 'color', cmap(ii,:), ...
        'markeredgecolor', cmap(ii,:)), h);
set([h.lwhis h.uwhis], 'linestyle', '-');
set(h.out, 'marker', '.');

boxplot2 example


Community contributions to this package are welcome!

To report bugs, please submit an issue here, and include:

  • your operating system
  • your version of Matlab and all relevant toolboxes (type ver at the Matlab command line to get this info)
  • code/data to reproduce the error or buggy behavior, and the full text of any error messages received

Please also feel free to submit enhancement requests, or to send pull requests for bug fixes or new features.

I do monitor the MatlabCentral FileExchange entry for any issues raised in the comments, but would prefer to track issues here on GitHub.

인용 양식

Kelly Kearney (2024). boxplot2 (, GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2016a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
태그 태그 추가

Community Treasure Hunt

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

Start Hunting!



GitHub 디폴트 브랜치를 사용하는 버전은 다운로드할 수 없음

버전 게시됨 릴리스 정보

linked GitHub readme

Edited title

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.