{ "info": { "author": "Jessica B. Hamrick", "author_email": "jhamrick@berkeley.edu", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# plotchecker\n\n[![Build Status](https://travis-ci.org/jhamrick/plotchecker.svg?branch=master)](https://travis-ci.org/jhamrick/plotchecker)\n[![codecov.io](http://codecov.io/github/jhamrick/plotchecker/coverage.svg?branch=master)](http://codecov.io/github/jhamrick/plotchecker?branch=master)\n[![Documentation Status](https://readthedocs.org/projects/plotchecker/badge/?version=latest)](http://plotchecker.readthedocs.org/en/latest/?badge=latest)\n\nA set of utilities for checking and grading matplotlib plots. **Please note that `plotchecker` is only compatible with Python 3, and not legacy Python 2**. Documentation is available on [Read The Docs](https://plotchecker.readthedocs.org/).\n\n## Installation\n\nTo install `plotchecker`:\n\n```\npip3 install plotchecker\n```\n\n## Background\n\nThe inspiration for this library comes from including plotting exercises in programming assignments. Often, there are multiple possible ways to solve a problem; for example, if students are asked to create a \"scatter plot\", the following are all valid methods of doing so:\n\n```python\n# Method 1\nplt.plot(x, y, 'o')\n\n# Method 2\nplt.scatter(x, y)\n\n# Method 3\nfor i in range(len(x)):\n plt.plot(x[i], y[i], 'o')\n\n# Method 4\nfor i in range(len(x)):\n plt.scatter(x[i], y[i])\n```\n\nUnfortunately, each of the above approaches also creates a different underlying representation of the data in matplotlib. Method 1 creates a single Line object; Method 2 creates a single Collection; Method 3 creates *n* Line objects, where *n* is the number of points; and Method 4 creates *n* Collection objects. Testing for all of these different edge cases is a huge burden on instructors.\n\nWhile some of the above options are certainly better than others in terms of simplicity and performance, it doesn't seem quite fair to ask students to create their plots in a very specific way when all we've asked them for is a scatter plot. If they look pretty much identical visually, why isn't it a valid approach?\n\nEnter `plotchecker`, which aims to abstract away from these differences and expose a simple interface for instructors to check students' plots. All that is necessary is access to the `Axes` object, and then you can write a common set of tests for plots independent of how they were created.\n\n```python\nfrom plotchecker import ScatterPlotChecker\n\naxis = plt.gca()\npc = ScatterPlotChecker(axis)\npc.assert_x_data_equal(x)\npc.assert_y_data_equal(y)\n...\n```\n\nPlease see the [Examples.ipynb](Examples.ipynb) notebook for futher examples on how `plotchecker` can be used.\n\nCaveats: there are *many* ways that plots can be created in matplotlib. `plotchecker` almost certainly misses some of the edge cases. If you find any, please submit a bug report (or even better, a PR!).\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jhamrick/plotchecker", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "plotchecker", "package_url": "https://pypi.org/project/plotchecker/", "platform": "", "project_url": "https://pypi.org/project/plotchecker/", "project_urls": { "Homepage": "https://github.com/jhamrick/plotchecker" }, "release_url": "https://pypi.org/project/plotchecker/0.2.0/", "requires_dist": [ "matplotlib>=2", "numpy", "six" ], "requires_python": "", "summary": "A set of utilities for testing matplotlib plots in an object-oriented manner.", "version": "0.2.0" }, "last_serial": 3591605, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "b295cba85f0a964969d521f8d08bf155", "sha256": "d1a5948b78d9cb5a0d6d2ff780780e537622f6db2de43de8a38cacd035c6ee14" }, "downloads": -1, "filename": "plotchecker-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b295cba85f0a964969d521f8d08bf155", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15439, "upload_time": "2015-10-09T00:05:53", "url": "https://files.pythonhosted.org/packages/82/47/dd4df9b707ac6080ce647a60d37693c5fc6ac3da4fa1267b1491f18a3758/plotchecker-0.1.0-py2.py3-none-any.whl" } ], "0.1.0.dev": [ { "comment_text": "", "digests": { "md5": "a8852095cd43cec014866a0155399eef", "sha256": "2bfa4bef62c9e4610e20d61f17e9898da7a6ba20d3783d5da349f619ae1bbe13" }, "downloads": -1, "filename": "plotchecker-0.1.0.dev-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a8852095cd43cec014866a0155399eef", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11647, "upload_time": "2015-10-08T16:01:07", "url": "https://files.pythonhosted.org/packages/3b/98/077a6a0ab14febdf5554893851cb59d31ad15691fc484fbc4ec30c5a93c2/plotchecker-0.1.0.dev-py2.py3-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "1924e4fc473eb77f9f273af04391f461", "sha256": "01c5d2a7e549553e463729777c365ff6204742cc86f0bc2a5cbbb276da10744c" }, "downloads": -1, "filename": "plotchecker-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1924e4fc473eb77f9f273af04391f461", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 116058, "upload_time": "2018-02-17T19:21:27", "url": "https://files.pythonhosted.org/packages/30/0f/99ad6ee7e2ff85c36b1359db9f1718b47f9228a6bebe9ee161f236c6b7af/plotchecker-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dbd42b7e117e7a49513e68c9cf86947c", "sha256": "18bc08ad2900365beb5e54a96d77927feae2e12efc1484b1ea0d0ccc491f971c" }, "downloads": -1, "filename": "plotchecker-0.2.0.tar.gz", "has_sig": false, "md5_digest": "dbd42b7e117e7a49513e68c9cf86947c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 75014, "upload_time": "2018-02-17T19:21:32", "url": "https://files.pythonhosted.org/packages/28/09/f4a15d3ebc6f7b9d514c33279ecc884928b1a4c976583a9e713a955269c7/plotchecker-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1924e4fc473eb77f9f273af04391f461", "sha256": "01c5d2a7e549553e463729777c365ff6204742cc86f0bc2a5cbbb276da10744c" }, "downloads": -1, "filename": "plotchecker-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1924e4fc473eb77f9f273af04391f461", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 116058, "upload_time": "2018-02-17T19:21:27", "url": "https://files.pythonhosted.org/packages/30/0f/99ad6ee7e2ff85c36b1359db9f1718b47f9228a6bebe9ee161f236c6b7af/plotchecker-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dbd42b7e117e7a49513e68c9cf86947c", "sha256": "18bc08ad2900365beb5e54a96d77927feae2e12efc1484b1ea0d0ccc491f971c" }, "downloads": -1, "filename": "plotchecker-0.2.0.tar.gz", "has_sig": false, "md5_digest": "dbd42b7e117e7a49513e68c9cf86947c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 75014, "upload_time": "2018-02-17T19:21:32", "url": "https://files.pythonhosted.org/packages/28/09/f4a15d3ebc6f7b9d514c33279ecc884928b1a4c976583a9e713a955269c7/plotchecker-0.2.0.tar.gz" } ] }