# squarest-divisors
A small utility to compute the squarest pair of divisors for an integer.
# Installation
Install from PyPI:
```
$ pip install sqdiv
```
# Usage
The original intended usage is with `matplotlib`, to automatically figure out how many rows and columns are needed based on the number of subplots I actually need to plot.
Let's say I had a series of 11 things I needed to plot on a `matplotlib` figure, something akin to a [`seaborn.FacetGrid`](https://seaborn.pydata.org/generated/seaborn.FacetGrid.html), but with some custom things added.
```python
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from sqdiv import n_rows_cols
height = 3
nrows, ncols = n_rows_cols(len(labels)) # len(labels) == 11
fig = plt.figure(figsize=(ncols * height, nrows * height))
gs = GridSpec(nrows=nrows, ncols=ncols)
# Now, setup the axes to plot on.
axes = dict()
for i, c in enumerate(labels):
# This allows us to share axes across the plots.
if i != 0:
axes[c] = fig.add_subplot(gs[i], sharey=axes[labels[0]])
else:
axes[c] = fig.add_subplot(gs[i])
axes[c].set_title(f'{c}')
axes[c].set_xlabel('x')
axes[c].set_ylabel('y')
# Below here, plot to your heart's content on each axes object.
```
The trivial case (1 by number of items) is not provided as part of the functionality because, hey, it's trivial!
# Feature Requests
Contributions are welcome. If you'd like to submit something, let's discuss on the [GitHub Issues tracker](https://github.com/ericmjl/squarest-divisors/issues) first.
Because `sqdiv` is currently maintained by volunteers and has no fiscal support, any feature requests will be prioritized according to what maintainers encounter as a need in our day-to-day jobs. Please temper expectations accordingly.
A small utility to compute the squarest pair of divisors for an integer.
# Installation
Install from PyPI:
```
$ pip install sqdiv
```
# Usage
The original intended usage is with `matplotlib`, to automatically figure out how many rows and columns are needed based on the number of subplots I actually need to plot.
Let's say I had a series of 11 things I needed to plot on a `matplotlib` figure, something akin to a [`seaborn.FacetGrid`](https://seaborn.pydata.org/generated/seaborn.FacetGrid.html), but with some custom things added.
```python
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from sqdiv import n_rows_cols
height = 3
nrows, ncols = n_rows_cols(len(labels)) # len(labels) == 11
fig = plt.figure(figsize=(ncols * height, nrows * height))
gs = GridSpec(nrows=nrows, ncols=ncols)
# Now, setup the axes to plot on.
axes = dict()
for i, c in enumerate(labels):
# This allows us to share axes across the plots.
if i != 0:
axes[c] = fig.add_subplot(gs[i], sharey=axes[labels[0]])
else:
axes[c] = fig.add_subplot(gs[i])
axes[c].set_title(f'{c}')
axes[c].set_xlabel('x')
axes[c].set_ylabel('y')
# Below here, plot to your heart's content on each axes object.
```
The trivial case (1 by number of items) is not provided as part of the functionality because, hey, it's trivial!
# Feature Requests
Contributions are welcome. If you'd like to submit something, let's discuss on the [GitHub Issues tracker](https://github.com/ericmjl/squarest-divisors/issues) first.
Because `sqdiv` is currently maintained by volunteers and has no fiscal support, any feature requests will be prioritized according to what maintainers encounter as a need in our day-to-day jobs. Please temper expectations accordingly.
Metadata
Release files for sqdiv 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqdiv-0.1.tar.gz | 2.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqdiv-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.3 kB
Release files / sqdiv-0.1.tar.gz
| Download URL | sqdiv-0.1.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a390b05f4177d9d5b4234751004c7210dd28496194830761220a9405996c0fdc
|
|
BLAKE2b-256 checksum How to use checksums |
0a3bf76dd7dacd030acd412c0dd2d2e1571ae8f1ac7460d56d7804e45263f70f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
|
Release files / sqdiv-0.1-py3-none-any.whl
| Download URL | sqdiv-0.1-py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be20beb0f16fb4a49f08b8b58c0f0f2640085c5edd6b521c6ec227ef05f44502
|
|
BLAKE2b-256 checksum How to use checksums |
a247ea576c92978e0e162d511fea597a11984c839866fda427df1c5218bc650f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
|