{ "cells": [ { "cell_type": "markdown", "id": "plot-title", "metadata": {}, "source": "# Plotting\n\nnumbl's plotting commands render through its figure renderer, straight\ninto the cell output, with no display server involved. 3-D figures are\ninteractive (drag to rotate).\n\nFigures are per-cell, like inline matplotlib: each cell renders the figures\nits own commands produce." }, { "cell_type": "code", "execution_count": null, "id": "plot-lines", "metadata": {}, "outputs": [], "source": [ "x = linspace(0, 2*pi, 200);\n", "plot(x, sin(x), 'b-');\n", "hold on;\n", "plot(x, cos(x), 'r--');\n", "hold off;\n", "title('sin and cos');\n", "xlabel('x');\n", "legend('sin', 'cos');" ] }, { "cell_type": "code", "execution_count": null, "id": "plot-subplot", "metadata": {}, "outputs": [], "source": [ "subplot(1, 2, 1); plot(x, sin(x)); title('sin(x)');\n", "subplot(1, 2, 2); plot(x, sin(2*x)); title('sin(2x)');" ] }, { "cell_type": "code", "execution_count": null, "id": "plot-imagesc", "metadata": {}, "outputs": [], "source": [ "Z = peaks(80);\n", "imagesc(Z);\n", "colorbar;\n", "title('peaks');" ] }, { "cell_type": "code", "execution_count": null, "id": "plot-surf", "metadata": {}, "outputs": [], "source": "surf(peaks(40));\ntitle('peaks surface (drag to rotate)');" } ], "metadata": { "kernelspec": { "display_name": "numbl (MATLAB syntax)", "language": "numbl", "name": "numbl" }, "language_info": { "codemirror_mode": "octave", "file_extension": ".m", "mimetype": "text/x-octave", "name": "numbl", "pygments_lexer": "matlab" } }, "nbformat": 4, "nbformat_minor": 5 }