Skip to main content

Extension package for tkintertools to matplotlib

Project description

tkintertools-mpl

https://xiaokang2022.github.io/tkintertools/

Extension package of tkintertools for matplotlib

Version Downloads Total Downloads Size
Watchers Forks Stars Issues Pull Requests Discussions

Insights

Star History Chart

📦 Installation

pip install tkintertools-mpl

👀 Preview

preview-1

import math

import matplotlib.figure
import numpy

import tkintertools
from tkintertools import mpl, theme

mpl.set_mpl_default_theme(theme.get_color_mode())

x = numpy.linspace(-math.tau, math.tau, 100)
y = numpy.sin(x)

figure = matplotlib.figure.Figure()
axes = figure.add_subplot()
axes.plot(x, y)

axes.set(xlabel='x', ylabel='y', title='Plotting based on the theme in tkt')
axes.legend(["$y=sin(x)$"])
axes.grid()

root = tkintertools.Tk((960, 720), title="tkintertools-mpl")
root.center()
canvas = tkintertools.Canvas(auto_zoom=True)
canvas.place(width=960, height=720)
figure_canvas = mpl.FigureCanvas(canvas, figure)
toolbar = mpl.FigureToolbar(canvas, figure_canvas)
figure_canvas.pack(side="top", fill="both", expand=True)

root.mainloop()

preview-2

import matplotlib.figure
import numpy

import tkintertools
from tkintertools import mpl, theme

mpl.set_mpl_default_theme(theme.get_color_mode())

figure = matplotlib.figure.Figure()
axes = figure.add_subplot(projection='3d')

colors = ['r', 'g', 'b', 'y']
yticks = [3, 2, 1, 0]

for c, k in zip(colors, yticks):
    xs = numpy.arange(20)
    ys = numpy.random.rand(20)
    cs = [c] * len(xs)
    cs[0] = 'c'
    axes.bar(xs, ys, zs=k, zdir='y', color=cs, alpha=0.7)

axes.set_xlabel('X')
axes.set_ylabel('Y')
axes.set_zlabel('Z')
axes.set_title("3D plotting with interoperability")

axes.set_yticks(yticks)

root = tkintertools.Tk((960, 720), title="tkintertools-mpl")
root.center()
canvas = tkintertools.Canvas(auto_update=True)
canvas.place(width=960, height=720)
figure_canvas = mpl.FigureCanvas(canvas, figure)
toolbar = mpl.FigureToolbar(canvas, figure_canvas)
figure_canvas.pack(side="top", fill="both", expand=True)

root.mainloop()

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

tkintertools_mpl-1.2.3.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

tkintertools_mpl-1.2.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file tkintertools_mpl-1.2.3.tar.gz.

File metadata

  • Download URL: tkintertools_mpl-1.2.3.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for tkintertools_mpl-1.2.3.tar.gz
Algorithm Hash digest
SHA256 70169a55cbaa505886b557d5f9685553de18df1d026be76d3c378cd8ca00e00a
MD5 d907021448ab63732847e2cce1482d66
BLAKE2b-256 d9a5379e4eed947156476ad538203e4bf049ac746377871088e4c23f5050d39e

See more details on using hashes here.

File details

Details for the file tkintertools_mpl-1.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for tkintertools_mpl-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 074e18f79fa63e98165a1f123844b2d29b4a88c8f507bc526903e3db5df5f697
MD5 9e3954d30a5b8cabbfabdc71f8231c4c
BLAKE2b-256 f49e1d6b7a799ee1b01fc65bcca14d11eded677bb5892b41f20ffa3c36d5529c

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