Catch-all page for notes relating to Matlab plotting functions.

Plotting-related documentation

Basic figure objects



get
current
create
clear
close/
remove


Properties
see
also
root
0





Root properties
root object
figure
gcf
figure()
clf
close( )


Figure Properties

axes
gca
axes()
cla



axes properties
Axis
surfaceplot






surfaceplot properties

line






Line properties

text






Text properties

light






Light properties

camera






see axes props










object
gco







callback
object
gcbo
















Plotting functions and objects


Related issues

Quality of images saved from figure:

Poor quality when saving figure images
Discusses how to use imwrite instead of saveas. Imwrite method might motivate adjusting the resolution using something like:
set(figureHandle, 'Position', [1 100 imageSize(1) imageSize(2)]);
... but unfortunately 'Position' doesn't update font sizes nor position of auxiliary objects like colorbars. Sigh.
Alternative is the export_fig libary: http://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig
... though this looks a little daunting and has umpteen dependencies, though perhaps not for simple output formats like PNG or JPG.

Grid color tied to tick label color

Various discussion threads advise to create a second axes object and use the resulting two axes objects such that one axes provides the grid, and the other the tick labels. Then the colors of each can be established separately. However, this doesn't work properly as the two axes objects don't stay registered upon resizing the figure window.

Alternative solution is to stick with a single axes object, hide its grid, and then use one or another plot function to plot lines where you want the grid. Then the pseudo-grid lines can be colored and styled using line styles. In the case that the axis limits and tick marks are set to auto, their locations can be found from XLim, YLim etc and XTick, YTick etc.