Skip to main content

Render matplotlib charts with eCharts

Project description

ptoe (matPlotlib To ECharts)

ptoe is an experimental library that converts charts created with matplotlib 👉 into interactive HTML outputs powered by ECharts.

Core Philosophy

“Keep matplotlib syntax as-is, only change the output to ECharts.”

Supported Chart Types (v0.4.2)

Bar Chart

  • Single bar
  • Multiple series bar
  • Stacked bar (bottom=)
plt.bar(x, y1)
plt.bar(x, y2, bottom=y1)
ptoe.show()

*Automatically detects legend and stack *Supports category x-axis

Line Chart

  • Standard line
  • step line (plt.step, steps-pre/mid/post)
plt.plot(x, y)
plt.step(x, y, where="post")
ptoe.show()

*Automatically detects numeric / category x-axis *Converts step lines to ECharts step option

Scatter Plot

plt.scatter(x, y)
ptoe.show()

*matplotlib scatter → ECharts scatter

Area Chart

plt.fill_between

plt.fill_between(x, y)
ptoe.show()

*Detected via PolyCollection *Converted to ECharts line + areaStyle

Histogram

Directly computed using numpy.histogram()

ptoe.show(
    data=data,
    chart_type="hist",
    bins=30,
    density=False,
    cumulative=False,
    hist_range=[-3, 3],
    color="green",
    alpha=0.4,
    edgecolor="black",
)

Boxplot

Directly computed using original data

ptoe.show(
    data=data,
    chart_type="boxplot",
)

*Does NOT reuse matplotlib results *Quartiles and whiskers calculated manually *Can be used without matplotlib

Heatmap

ptoe.show(
    data=data,
    chart_type="heatmap",
)

*Uses 2D array directly *Automatically calculates min / max *Automatically generates visualMap *Can be used without matplotlib

Common Style Options

  • color
  • alpha
  • edgecolor
  • linewidth

Execution Modes

Convert matplotlib result

plt.plot(x, y)
ptoe.show()

Requires original data

ptoe.show(
    data=data,
    chart_type="hist",
)

*Recommended for hist / boxplot / heatmap

Running Methods

Jupyter / Colab

ptoe.show(inline=True)

Local (HTML)

ptoe.show()

Design Overview

  • Analyze matplotlib objects (wrap mode)
  • Automatic chart_type detection
  • Statistical charts computed from raw data
  • Generate ECharts options
  • Render HTML

Version History

v0.4.2

  • Transitioned to chart_type-based structure
  • Introduced raw data computation for hist, boxplot, heatmap
  • Partial style option support

One-Line Summary

ptoe is a tool for matplotlib users that delivers Same syntax, upgraded output.

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

ptoe-0.4.2.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

ptoe-0.4.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file ptoe-0.4.2.tar.gz.

File metadata

  • Download URL: ptoe-0.4.2.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for ptoe-0.4.2.tar.gz
Algorithm Hash digest
SHA256 0fe0d1491152327c9d4939344cf29bf7695cc0c17015e0455ae32aa6b228d0ba
MD5 49e669222d8c537af7e0704b2cd67da6
BLAKE2b-256 ac22ae82ef437b9d1a66b881d7bdc9ea21e8033a6aad64c50b99f3379e2dece1

See more details on using hashes here.

File details

Details for the file ptoe-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: ptoe-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for ptoe-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fdd417d6dc974b14689d9fdefa31c6b49bd4cbfbe32e16334f4f6be8a26fbde3
MD5 e039be553b61e1eaa591b4f94135de59
BLAKE2b-256 a5e6e2814b51f7565b45723786007f2c303606aae69c1b9e7c77aaa5ef6a79dc

See more details on using hashes here.

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