Fully Loaded 2D Plotter

This function is capable of making a 2-dimensional pixel plot for a given data set or function
42 Downloads
Updated 5 Jan 2017

View License

This function is capable of drawing a thermal plot for two input types.
1. For @FunctionHandle plots:
Example: thermalPlot([-100 100],[-250 250],@(x,y)(sqrt(x.*y)),'TITLE_','$$\sqrt{\chi\gamma}$$','X_LABEL','\chi','Y_LABEL','\gamma','xTickRes',20,'yTickRes',25)
% 2. For matrix plots:
Example: thermalPlot([-5 5],[-10 25],randi(10,[1e3 1e3]))
Example: thermalPlot([-100 100],[-250 250],randi(1e2,[2e2,5e2]),'TITLE_','$$Z$$','X_LABEL','x','Y_LABEL','y','xTickRes',20,'yTickRes',25,'MAP_TYPE','pink','COMP_SWITCH','abs','X_TICK_ANGLE',90)
Inputs
1. x_range must be of form [x(1) x(2)] for @FunctionHandle plots. x_range must be of for m[x(1) x(2)] or a linear vector for matrix plots. When a linear vector, length(x_range)>2&&XLENGTH(Z)==length(x_range)
2. y_range - same as above for Y axis

3. Z - can be a @FunctionHandle or a Matrix (Dimensions must match, see x_range). Z is assumed to be arranged in the Cartesian standard where the bottom left index [y(end),x(1)] holds the (min(Z(y)),min(Z(x)) data point and the top right data point holds the (max(Z(y)),max(Z(x)) data point.
https://en.wikipedia.org/wiki/Cartesian_coordinate_system#/media/File:Cartesian-coordinate-system.svg

Additional Inputs

1. x_res - used in @FunctionHandle plots to generate xVector x(1):x_res:x(2) Ignored for matrix type plots
2. x_tick_range - must be of form [x(1) x(2)] denoting start and end points of the tick labels
3. x_tick_res - res of x_tick_label.
4. XTICKVECTOR = x_tick_res(1):x_tick_res:x_tick_res(2)
5. IGNORE_LARGE_MATRIX - set 1 to plot for large matrices (dim>1e4)
6. COMP_SWITCH - for complex outputs, set to 'real','imag','abs' for respective plot.
7. TITLE_ - plot title as a string
8. X_LABEL - x label as a string
9. X_TICK_ANGLE - sets X tick angle
10. xTickFormat - Refer to xtickformat inputs in help doc.

Where applicable, analogus functions exist for the y axis as well...

Please check the examples to understand the functionality of the code

Cite As

Sudaraka Mallawaarachchi (2024). Fully Loaded 2D Plotter (https://www.mathworks.com/matlabcentral/fileexchange/61020-fully-loaded-2d-plotter), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015b
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!
Version Published Release Notes
1.0.0.0

Changed the file name
Changed Description