Skip to main content
# 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.


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqdiv-0.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqdiv-0.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file sqdiv-0.1.tar.gz.

File metadata

  • Download URL: sqdiv-0.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for sqdiv-0.1.tar.gz
Algorithm Hash digest
SHA256 a390b05f4177d9d5b4234751004c7210dd28496194830761220a9405996c0fdc
MD5 c8d6f3f71a95a94f8f26eb8610c8f4e1
BLAKE2b-256 0a3bf76dd7dacd030acd412c0dd2d2e1571ae8f1ac7460d56d7804e45263f70f

See more details on using hashes here.

File details

Details for the file sqdiv-0.1-py3-none-any.whl.

File metadata

  • Download URL: sqdiv-0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for sqdiv-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 be20beb0f16fb4a49f08b8b58c0f0f2640085c5edd6b521c6ec227ef05f44502
MD5 8d51bf2b1fc30c1d2a47f64456180029
BLAKE2b-256 a247ea576c92978e0e162d511fea597a11984c839866fda427df1c5218bc650f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page