Skip to main content

Print your insights, anytime, anywhere

Project description

ChartOut - Python package

Print Your Insights, Anytime, Anywhere

With every purchase, we donate 10% to NumFOCUS to support open-source scientific software.

ChartOut turns data visualizations into beautiful, printed products. You create a chart, pick a product, and chartout handles everything from 3D preview to order fulfilment.

Install

pip install chartout

Quick start

import altair as alt
import chartout

chart = alt.Chart(data).mark_point().encode(x='x', y='y')

store = chartout.Store(chart)
store  # renders the interactive widget in Jupyter

ChartOut store widget

Discover products

chartout.products()  # returns a list of available product dicts with id, name, and placements
[{'name': 'Mouse Pad (White / 8.7″x7.1″)',
  'id': 'mousepad_white_8x7',
  'placements': [{'id': 'default', 'print_ratio': '6:5'}]},
 {'name': 'Canvas (10″x10″)',
  'id': 'canvas_10x10',
  'placements': [{'id': 'default', 'print_ratio': '1:1'}]},
 {'name': 'Canvas (16″x32″) Vertical',
  'id': 'canvas_16x32_vertical',
  'placements': [{'id': 'default', 'print_ratio': '27:50'}]},
 {'name': 'Canvas (16″x32″) Horizontal',
  'id': 'canvas_16x32_horizontal',
  'placements': [{'id': 'default', 'print_ratio': '50:27'}]},
 {'name': 'Ceramic Mug with Color Inside (Black / 11 oz)',
  'id': 'mug_black_11oz',
  'placements': [{'id': 'default', 'print_ratio': '18:7'}]},
 {'name': 'Ceramic Mug with Color Inside (Green / 11 oz)',
  'id': 'mug_green_11oz',
  'placements': [{'id': 'default', 'print_ratio': '18:7'}]}]

Use the id values (e.g. 'mug_black_11oz', 'canvas_16x32_horizontal') as the first argument to chartout.item().

Create an item

chartout.item() wraps a chart and a product into a CartItem:

item = chartout.item('mug_green_11oz', chart)
item
CartItem(id='mug_green_11oz', name='Green Mug with my Viz', placements=[default], quantity=1)

The product id is validated against the API by default. Pass validate=False to skip the check when the id is already known.

Positioning

Control where the chart lands on the product via shorthand kwargs or an explicit PlacementPosition:

# shorthand — forwarded directly to PlacementPosition
item = chartout.item('mug_black_11oz', chart, horizontal='left', vertical='middle', scale=0.9)

# explicit
pos = chartout.PlacementPosition(
    horizontal='left',   # 'left' | 'center' | 'right'  (default: 'center')
    vertical='middle',   # 'top'  | 'middle' | 'bottom' (default: 'middle')
    scale=0.9,           # relative scale, optional
    dx=0.05,             # horizontal offset, optional
    dy=-0.02,            # vertical offset, optional
)
item = chartout.item('mug_black_11oz', chart, position=pos)
Parameter Values Default
horizontal 'left', 'center', 'right' 'center'
vertical 'top', 'middle', 'bottom' 'middle'
scale float
dx float
dy float

Build a cart

Group multiple items before opening the store:

cart = chartout.Cart([
    chartout.item('mug_black_11oz',          chart, horizontal='left',  quantity=2),
    chartout.item('canvas_16x32_horizontal', chart, horizontal='right', quantity=3),
    chartout.item('mousepad_white_8x7',      chart, horizontal='right', quantity=3),
])
cart  # prints a summary of all items
Cart:
  - ID: mug_black_11oz
    Name: mug_black_11oz
    Quantity: 2
    Placements: [default (middle, left)]
  - ID: canvas_16x32_horizontal
    Name: canvas_16x32_horizontal
    Quantity: 3
    Placements: [default (middle, right)]
  - ID: mousepad_white_8x7
    Name: mousepad_white_8x7
    Quantity: 3
    Placements: [default (middle, right)]

Add or remove items after creation:

cart.add(another_item)   # append a CartItem
cart.remove(index=0)     # remove by position

Open the store widget

Pass a single CartItem, a Cart, or a raw chart:

store = chartout.Store(item)   # single item
store = chartout.Store(cart)   # full cart
store = chartout.Store(chart)  # raw chart (no product selected yet)
store
Parameter Values Default Description
view 'cart', 'checkout' 'cart' Starting view
shipping_location {'country': 'NL'} Pre-fills country/state in checkout
store = chartout.Store(item, view='checkout', shipping_location={'country': 'NL'})
store

Add items to an open store without reopening it:

store.add_item(another_item)  # syncs to the widget immediately
store.cart                    # current cart state as a list of dicts

Supported chart types

Library Type Status
Altair alt.Chart and all chart types supported
matplotlib Figure (including seaborn) supported
Plotly go.Figure coming soon
pyobsplot ObsplotWidget coming soon
raw image bytes or bytearray supported

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

chartout-1.0.0a1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

chartout-1.0.0a1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file chartout-1.0.0a1.tar.gz.

File metadata

  • Download URL: chartout-1.0.0a1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for chartout-1.0.0a1.tar.gz
Algorithm Hash digest
SHA256 6a752fcc990b16a758cf9b6de594cf2f17050b57d199a9cd1e28f228c1f95e4b
MD5 70c73c6b44460d028926d31783467340
BLAKE2b-256 ca811e1e6133c619bbf568aa5b2bd8f2391c70f4bf4fdf6266b86c0ad87330bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for chartout-1.0.0a1.tar.gz:

Publisher: publish.yml on hoekinsights/chartout

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chartout-1.0.0a1-py3-none-any.whl.

File metadata

  • Download URL: chartout-1.0.0a1-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for chartout-1.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 0df7968831d9ffb98193a4b0042ef17e40422ecac0c6788eb20f336586a3fdb6
MD5 73000fbb3de98774d6c587af48b8ac7d
BLAKE2b-256 5214a9c78241cbbfe6608c5a26ece2195fee03208521574bdd98e61c91882d3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for chartout-1.0.0a1-py3-none-any.whl:

Publisher: publish.yml on hoekinsights/chartout

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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