Skip to main content

A small utility to compute the squarest pair of divisors for an integer.

Project description

# 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`](, but with some custom things added.

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]])
axes[c] = fig.add_subplot(gs[i])

# 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]( 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.

Project details

Release history Release notifications | RSS feed

This version


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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page