Extension package for tkintertools to matplotlib
Project description
tkintertools-mpl
tkintertools
对 matplotlib
的扩展包
Extension package for tkintertools
to matplotlib
📦 Installation / 安装
pip install tkintertools-mpl
[!IMPORTANT]
tkintertools
: https://github.com/Xiaokang2022/tkintertools
👀 Preview / 预览
Code
import math
import matplotlib.figure
import numpy
import tkintertools
import tkintertools.mpl
import tkintertools.style
tkintertools.mpl.set_mpl_default_theme(tkintertools.style.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(root, zoom_item=True)
canvas.place(width=960, height=720)
figure_canvas = tkintertools.mpl.FigureCanvas(figure, canvas)
toolbar = tkintertools.mpl.FigureToolbar(figure_canvas, canvas)
figure_canvas.pack(side="top", fill="both", expand=True)
root.mainloop()
Code
import matplotlib.figure
import numpy
import tkintertools
import tkintertools.mpl
import tkintertools.style
tkintertools.mpl.set_mpl_default_theme(tkintertools.style.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(root, zoom_item=True)
canvas.place(width=960, height=720)
figure_canvas = tkintertools.mpl.FigureCanvas(figure, canvas)
toolbar = tkintertools.mpl.FigureToolbar(figure_canvas, 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.1.0.tar.gz
(8.0 kB
view hashes)
Built Distribution
Close
Hashes for tkintertools_mpl-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfc3018e2260293c25aa65b218b0ba739092b6aa4a29da844a78b2cbad96e7ce |
|
MD5 | 9d66155058680c876cd3711a1de6ddd4 |
|
BLAKE2b-256 | fd624fb32a38ec0ebd76d28d3510dbebc3e081174745b26d715450f20523bace |