{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Figure positioning\n\nDemo for getting/setting the size and position of a figure.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from itom import figure\nfrom itom import dataObject\n\n\nfig = figure()\nfig.plot(dataObject.randN([100, 200]))\n\nfig[\"geometry\"]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Frame of figure window is the entire window including any title bar and window frame.\n\nproperties: ``frameGeometry, x, y``\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print(\"figure frame geometry (x,y,w,h):\", fig[\"frameGeometry\"])\nprint(\"figure position (x,y):\", fig[\"pos\"])\nprint(\"x, y:\", fig[\"x\"], fig[\"y\"])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The real plot area of the figure is accessible by ``geometry``, ``size``, ``width``, ``height``.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print(\"figure geometry (x,y,w,h):\", fig[\"geometry\"])\nprint(\"figure size (w,h):\", fig[\"size\"])\nprint(\"figure width:\", fig[\"width\"])\nprint(\"figure height:\", fig[\"height\"])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In order to change the outer position use the property ``pos``.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig[\"pos\"] = (0, 0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Size change: property ``size``.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig[\"size\"] = (500, 400)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In order to change the inner position and size use the property ``geometry``.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig[\"geometry\"] = (100, 200, 300, 200)" ] } ], "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 }