{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# A DataGeometry object or \"geo\"\n\nWhen the plot function is called, it returns a DataGeometry object, or geo. A\ngeo contains all the pieces needed to regenerate the plot. You can use the geo\nplot method to evaluate the same plot with new arguments, like changing the color\nof the points, or trying a different normalization method. To save the plot,\nsimply call geo.save(fname), where fname is a file name/path. Then, this file\ncan be reloaded using hyp.load to be plotted again at another time. Finally,\nthe transform method can be used to transform new data using the same transformations\nthat were applied to the geo.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Code source: Andrew Heusser\n# License: MIT\n\n# import\nimport hypertools as hyp\n\n# load some data\ngeo = hyp.load('mushrooms')\n\n# plot\nt = geo.plot()\n\n# replot with new parameters\ngeo.plot(normalize='within', color='green')\n\n# save the object\n# geo.save('test')\n\n# load it back in\n# geo = hyp.load('test.geo')\n\n# transform some new data\n# transformed_data = geo.transform(data)\n\n# transform some 'new' data and plot it\n# hyp.plot(transformed_data, '.')\n\n# get a copy of the data\n# geo.get_data()\n\n# get the formatted data\n# geo.get_formatted_data()" ] } ], "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.12.4" } }, "nbformat": 4, "nbformat_minor": 0 }