image thumbnail

linecm

version 1.2.0 (37.5 KB) by Simon Thor
Plot a line with changing color over the course of a line

12 Downloads

Updated28 Feb 2021

From GitHub

View license on GitHub

linecm

View linecm on File Exchange

Plot a line with changing color over the course of a line.

To plot a line, run

linecm(x,y, @colormap_functionhandle);

Just like that! You now have a much better looking line. Here is an example:

set(0,'DefaultLineLineWidth',2); x=0:0.1:2; y=sin(x);subplot(1,2,1)line(x,y,'Color','b')title("Regular line")subplot(1,2,2)linecm(x,y, @parula);%semicolon is recommendedtitle("linecm")

很明显,linecmlooks much better!

Colormaps

In this file, two additional colormaps have been added:coolwarmandbwr, inspired by matplotlib. You can read more about themhere.

Similar programs

There is a similar program available calledcolormaplinewhich might be less error prone.

Trivia

Might be quite obvious butlinecmstands for "line colormap".

Cite As

Simon Thor (2022).linecm(https://github.com/simonthor/linecm/releases/tag/v1.2.0), GitHub. Retrieved.

MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
To view or report issues in this GitHub add-on, visit theGitHub Repository.
To view or report issues in this GitHub add-on, visit theGitHub Repository.