File Exchange

image thumbnail

myplot: conveniently plotting multiple curves in 2D

version 1.0.0 (4.33 KB) by Chi-Hang Lam
A wrapper of "plot'. Multiple calls of myplot generate curves automatically cycling through a sequence of styles and colors.

10 Downloads

Updated 09 Jan 2019

View License

% A wrapper of "plot" for convienient 2D-plot of multiple curves.
% Multiple calls of myplot (with 'hold' switched on) generate curves
% automatically cycling through a sequence of styles and colors,
% and automatically numbered in the legend.
% By Chi-Hang Lam, Jan 2019
%
% Usage: myplot( [<options>], [<arguments>], ... )
% <arguments> :
% arguments to be sent to the 'plot' function
% <options>:
% 'll' 'lx' 'ly' :set log-log or semi-log scales
% 'po' 'li' 'lp' :set style of this and subsequent curves to point, line, or linepoint
% 'dot' 'dash' 'dashdot' :set line style to dotted, dashed, or dashed-dotted
% 'style', <style> :set default style to <style> = 'po', 'li', or 'lp'
% 'color',<index> :set color based on <index>
% 'marker',<index> :set marker based on <index>
% 'noinc' :do not automatically advance to next color/marker for this curve
% 'group', <n> :sebsequent cuvers advance to next marker/color after every <n> curves
% 'ctitle',<ctitle> :set curve label to <ctitle> in legend
% 'noleg' :do not show curve in legend
% 'clear' :clear plot and reset curve counter
% 'graph',0 :do not plot this curve, i.e. neglect this function call
% 'jet',<ncolor> :use matlab's jet colormap with <ncolor> colors for this curve
%
% Arguments and options can be mixed in arbitrary order
% Requires: getopt.m
% e.g. x=1:10; hold on; myplot('ll', x,x); myplot(x,2*x);
% See myplotdemo.m for more examples

Cite As

Chi-Hang Lam (2019). myplot: conveniently plotting multiple curves in 2D (https://www.mathworks.com/matlabcentral/fileexchange/69946-myplot-conveniently-plotting-multiple-curves-in-2d), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)

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

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor