Figures
Figures are drawn next to the code that creates them, and each one can also open in a floating window. Hover a plot and a crosshair reads values off it.
- Plots: 2-D and 3-D lines and scatter plots, surfaces with lighting, contours, images, bar, pie, histogram, polar plots and more.
- Charts: heatmaps, box, swarm and bubble charts, pie and donut charts, word clouds, stacked plots and parallel coordinates.
- Layout and decoration: two y axes (
yyaxis,plotyy), tiled layouts and subplots, annotations, legends, colorbars, date ticks and data tips. - Handles: graphics objects are handles, so
get,set,findobjand arrays of handles work as in MATLAB. - Saving:
saveas,printandexportgraphicswrite PNG and SVG.
x = linspace(0, 2*pi, 200);
plot(x, sin(x), 'LineWidth', 2)
hold on
plot(x, cos(x), '--', 'LineWidth', 2)
hold off
grid on
title('Sine and cosine')
legend('sin', 'cos')
exportgraphics(gcf, 'sine.png')