Skip to main content

A basic extension library for creating strip plots or dot charts w/ matplotlib + seaboard

Project description

Great things come in tiny packages. A bare minimum extension library with the sole aim of providing a dot plot (aka strip plot/dot chart)

  • Designed to work with matplotlib and seaborn.
  • Provides a simple yet powerful interface for visualizing data distributions, frequencies and categories.

installation

pip install dotplotlib

basic usage

dotplotlib can be used to generate dot charts with minimal code. Here are some basic examples

Example 1: Simple Dot Chart

.dotchart returns x and y lists that can be inputted straight into matplotlib or seaborn scatterplots.

from dotplotlib import dotchart
import matplotlib.pyplot as plt

# Data preparation
data = {'size': [1, 2, 3, 4, 5, 6]}

# Generate dot chart data
x, y = dotchart(data['size'])

# Plot
plt.scatter(x, y)
plt.show()

Example 2: Dot Chart with Color Mapping

Returns an extra c list that should be passed into the c= parameter if using matplotlib or hue= if using seaborn.

from dotplotlib import dotchart
import matplotlib.pyplot as plt

# Data preparation
data = {'size': [1, 2, 3, 4, 5, 6], 'rating': [3, 2, 5, 4, 3, 6]}

# Generate dot chart data with color mapping
x, y, c = dotchart(data['size'], color_by=data['rating'])

# Plot with color mapping
plt.scatter(x, y, c=c, cmap='viridis')
plt.colorbar()
plt.xlabel('Size')
plt.ylabel('Number')
plt.title('Mushroom Size Count Colored by Rating')
plt.show()

Example 3: Using make_dotchart for Simplified Plotting

Instead of just giving you x, y data to make the plot yourself, make_dotplot() actually generates the plot.

from dotplotlib import make_dotchart

# Data preparation
test_df = {'size': [1, 2, 3, 4, 5, 6], 'rating': [3, 2, 5, 4, 3, 6]}

# Create a dot chart with additional customization
make_dotchart(test_df['size'], color_by=test_df['rating'], dot_size=40, theme='gnuplot2')

preset themes

custom:lavender

cmap

Any cmap value supported by matplotlib (see here) will work when passed into theme='viridis'.

viridis:

gnuplot:


features

  • generate strip plots/dot charts by exploiting matplotlib/seaborn scatterplots
  • supports any cmap color profile
  • the data can be automatically sorted for better visualization, especially when using color mapping.
  • accepts both list and pandas.Series as input data.
  • set custom labels, titles, and dot sizes for your charts.

credit

Project details


Download files

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

Source Distribution

dotplotlib-0.1.3.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

dotplotlib-0.1.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file dotplotlib-0.1.3.tar.gz.

File metadata

  • Download URL: dotplotlib-0.1.3.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for dotplotlib-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6c694e229be20c67587c16c19b72a8469ba7880c86278361efee451dcf1fab08
MD5 068856ca4a1db92ef3c3771c8ee35152
BLAKE2b-256 53456d93df8929b687d8364411da73ec7e7a68e7b7d3f1e4e2d0ef94d896e016

See more details on using hashes here.

File details

Details for the file dotplotlib-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: dotplotlib-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for dotplotlib-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 38b809b1af2ea51078b773a0ca74c2082fd3b6163ae321fce871e5273afcf2fc
MD5 cec9c000d5d980760ad2ea0c557b788e
BLAKE2b-256 761cfb18c0846025909d4e16ab2b202ad74ff0ae7aa5a00a75a33200ec4a3ecd

See more details on using hashes here.

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