scatter_nice

版本 1.0 (178.2 KB) 作者: Eike Petersen
scatter wrapper that actually creates useful plots by default
106.0 次下载
更新时间 2021/12/25

scatter_nice

A wrapper for scatter(.) that

  1. chooses useful defaults for colors and marker size and shape (adaptive to the number of points to be plotted),
  2. allows for easy group-wise scatter plots,
  3. implements randomized-order plotting to prevent the last plotted data to (misleadingly) dominate plot appearance,
  4. uses nonlinear color scaling to exploit the full color range, and
  5. implements some automatic simple statistical annotations to be shown (optionally).

The goal is for this to be a one-stop function to easily create a useful and visually appealing scatter diagram.

Requires the cbrewer file exchange function to be on the path, see https://www.mathworks.com/matlabcentral/fileexchange/34087-cbrewer-colorbrewer-schemes-for-matlab. The file is included here for convenience; copyright remains with the original author.

The following are two examples comparing the default outputs of scatter(.) and scatter_nice(.). In the first example, the linear colormap used by scatter is completely useless due to a skewed distribution of data points. scatter_nice fixes this by using an automatically balanced nonlinear colormap. Moreover, outliers near the beginning of the input vector are completely invisible in the first plot since they are hidden by later datapoints. Using scatter_nice, they are easily visible because of a) the nonlinear colormap and b) randomized-order plotting.

In the second example, simply plotting two groups after another (with hold on) using scatter, the second group will completely hide the first. scatter_nice offers a simple interface for plotting multiple groups and plots them in randomized order.

In both examples, scatter_nice adaptively chooses a point size that is (to my eyes, at least) better suited to the number of datapoints, and selects a fitting and well-crafted colormap from cbrewer.

An example plot.


Eike Petersen, 2020-2021

This script has been developed while I was at the University of Lübeck, with the Institute for Electrical Engineering in Medicine.

引用格式

Eike Petersen (2024). scatter_nice (https://github.com/e-pet/scatter_nice/releases/tag/1.0), GitHub. 检索时间: .

MATLAB 版本兼容性
创建方式 R2019b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库