MATLAB for Visualization
Posted on Dec 03, 2012 in Computer Science
Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives.
-
To display a new graph on on top of an old one, you can use command
hold on
. In this way, you can create multiple plots in a same window. Thoughplot
can already do multiple plot, commandhold on
can be very useful when you want to add some new points or curves to an existing graph (e.g. a histogram). -
Function
subplot
displays multiple plots in the same window, which is similar to settingspar(mfrow=c(2,2))
orpar(mfcol=c(2,3))
in R. -
Function
hist
andhistc
produces histograms. -
Function
staris
produces step graph. -
Function
plot
plots2-D
graph while functionsurf
plots3-D
graphs. Functionsurf
is usually used in conjugate with functionmeshgrid
which can create a matrix of points over which the surface is to be plotted. You can also usendgrid
instead ofmeshgrid
to generate a matrix of points. However,ndgrid
is usually higher dimensions and the usage is a little different frommeshgrid
, so you have to be careful if you wan to use it. -
After plotting figures using
plot
, you can usetitle
to add titles for the figures,axis
to set configurations for the axies, andxlabel
andylabel
to set labels for the x and y axes. You can also useset
to set all configurations for the plots. To do this, you have to first get the handle of the elements in the plots that you want to modify, and then applyset
on it. -
inpolygon
can check whether given points are inside a polygon or not. -
spy
visualizes sparse matrices. -
image
can not only display images but also make mosaic plot (sometimes called heat plot or level plot) of a matrices. For example, to show the mosaic plot of matrixx
, you can useimage(x,'CDataMap','CDataMapping','scaled')
.