{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Contourlines 2D plot\n\nThis demo shows how to display contour lines in an ``itom.plot2``.\n\nThe contour levels can be set via the ``contourLevels`` property.\nThe expected type is a ``dataObject`` of shape ``1 x N`` of type\n``uint8``, ``int8``, ``uint16``, ``int16``, ``int32``,\n``float32`` or ``float64``. The line width and color map can\nbe adjusted by setting the property ``contourLineWidth`` and\n``contourColorMap`` respectively.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\nfrom itom import dataObject\nfrom itom import plot\n\nvec = np.linspace(-500, 501, 1001)\nx, y = np.meshgrid(vec, vec)\nr = np.sqrt(x ** 2 + y ** 2)\n\n[idx, handle] = plot(r)\nlevels = dataObject.randN([1, 3], \"uint8\")\nlevels[0, 0] = 50\nlevels[0, 1] = 75\nlevels[0, 2] = 250\n\nhandle[\"contourLevels\"] = levels\nhandle[\"contourColorMap\"] = \"hotIron\"\nhandle[\"contourLineWidth\"] = 5" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 0 }