quick plot
The scripting interface of matplotlib is stateful, therefore dangerous. The object oriented interface to the plotting library is polluted. This tiny library combines the two interfaces into one context manager.
fundament
If this file is somewhere in your =$PYTHONPATH=, the following code should produce a plot.
´´´python import numpy as np import quick
with quick.Plot() as qp: qp.plot(np.sin(np.linspace(0, 2 * np.pi))) ´´´
The =Plot= class is the only available class in the =quick= module. It should be instantiated exactly once. Its instance can do everything the matplotlib axis object can do. For some methods, a default configuration is supplied. There are some methods, that are not contained in the axis object, for example =trajectory=, =field=, =points=, =remove_border=, =remove_xticks=. When a method is called, that is neither a method of the =axis= object, nor one of the additional methods of this module, then the module =matplotlib.pyplot= is searched for a function with that name, and, if it exists, it is called. When the context manager is left, the plot shows up.
arguments
=Plot= takes optional arguments. | =filename= | given that, the plot is not shown interactively, but saved as a file, default =None= | | =figsize= | a tuple, representing (width, height), default =(3, 3)= | | =grid= | if =True= shows a grid, default =False | all other optional arguments are directly passed to =matplotlib.pyplot.subplot=.
short form
If you just want to quickly see some of your data, and you do not want to do any customization of the plotting result, the context manager is a bit of a boilerplate. So there is the following shorthand for the previous script.
´´´python import numpy as np import quick
quick.plot(np.sin(np.linspace(0, 2 * np.pi))) ´´´
The context manager is called implicitly.
more convenience
The quick module additionally provides a few methods that are not directly related to the =matplotlib= plotting facility, e.g.
- =colored=: takes a list of array and return an iterator with tuple, with the data and a color, that can be past to the color argument of plotting methods. Optional argument is the name of a colormap
- =landscape=, =portrait=: they return tuples that can be past to the =figsize= argument of =Plot=, internally using the golden ratio.
- =tex=: surround a string by dollar signs.
drawback
There is no interactive workflow anymore with this approach. I like that way of working, because due to script restarts you eliminate all errors in your script, that may occur from state changes from the past, that confuses the (fragile) python module system.
Metadata
Release files for quick-plot 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| quick-plot-0.0.2.tar.gz | 2.5 kB | Without provenance | Details for quick-plot-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| quick_plot-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for quick_plot-0.0.2-py3-none-any.whl |
Total release size: 5.5 kB
Release files / quick-plot-0.0.2.tar.gz
| Download URL | quick-plot-0.0.2.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d800f55ba38171212d5ec5a8f15d7384109ac569ebf0ebc732709445da01890f
|
|
BLAKE2b-256 checksum How to use checksums |
386aa7f0f68b432ae94db656d33b0b78f332ad62315958a5be04434b1ee6c39f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.8
|
Release files / quick_plot-0.0.2-py3-none-any.whl
| Download URL | quick_plot-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05ad2f46f047ebd5002b419660edbf5b3b8587697e79194bdd6443e0ef242798
|
|
BLAKE2b-256 checksum How to use checksums |
56f0266b916df8e70832106e3f014f6e12a56014faafc8d46539ecdf43e83799
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.8
|
Security for quick-plot 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.