<h1 align="center">tkintertools-mpl</h1>
<p align="center">Extension package for <code>tkintertools</code> to <code>matplotlib</code></p>
<p align="center">
<a href="https://github.com/Xiaokang2022/tkintertools-mpl/releases"><img alt="Version" src="https://img.shields.io/github/v/release/Xiaokang2022/tkintertools-mpl?include_prereleases&logo=github&label=Version" title="Latest Version" /></a>
<a href="https://pypistats.org/packages/tkintertools-mpl"><img alt="Downloads" src="https://img.shields.io/pypi/dm/tkintertools-mpl?label=Downloads&logo=pypi&logoColor=skyblue" title="Downloads" /></a>
<a href="https://pepy.tech/project/tkintertools-mpl"><img alt="Total Downloads" src="https://img.shields.io/pepy/dt/tkintertools-mpl?logo=pypi&logoColor=gold&label=Total%20Downloads" title="Total Downloads" /></a>
<a href="https://github.com/Xiaokang2022/tkintertools-mpl"><img alt="Size" src="https://img.shields.io/github/languages/code-size/Xiaokang2022/tkintertools-mpl?label=Size&logo=github" title="Code Size"/></a>
<br/>
<a href="https://github.com/Xiaokang2022/tkintertools-mpl/watchers"><img alt="Watchers" src="https://img.shields.io/github/watchers/Xiaokang2022/tkintertools-mpl?label=Watchers&logo=github&style=flat" title="Watchers" /></a>
<a href="https://github.com/Xiaokang2022/tkintertools-mpl/forks"><img alt="Forks" src="https://img.shields.io/github/forks/Xiaokang2022/tkintertools-mpl?label=Forks&logo=github&style=flat" title="Forks" /></a>
<a href="https://github.com/Xiaokang2022/tkintertools-mpl/stargazers"><img alt="Stars" src="https://img.shields.io/github/stars/Xiaokang2022/tkintertools-mpl?label=Stars&color=gold&logo=github&style=flat" title="Stars" /></a>
<a href="https://github.com/Xiaokang2022/tkintertools-mpl/issues"><img alt="Issues" src="https://img.shields.io/github/issues/Xiaokang2022/tkintertools-mpl?label=Issues&logo=github" title="Issues" /></a>
<a href="https://github.com/Xiaokang2022/tkintertools-mpl/pulls"><img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Xiaokang2022/tkintertools-mpl?label=Pull%20Requests&logo=github" title="Pull Requests" /></a>
<a href="https://github.com/Xiaokang2022/tkintertools-mpl/discussions"><img alt="Discussions" src="https://img.shields.io/github/discussions/Xiaokang2022/tkintertools-mpl?label=Discussions&logo=github" title="Discussions" /></a>
</p>
<p align="center">
<a href="https://github.com/Xiaokang2022/tkintertools-mpl/pulse"><img alt="Insights" src="https://repobeats.axiom.co/api/embed/16b936d7774f2727ca057af76b700997a60c9b67.svg" /></a>
</p>
<p align="center">
<a href="https://star-history.com/#Xiaokang2022/tkintertools-mpl&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Xiaokang2022/tkintertools-mpl&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Xiaokang2022/tkintertools-mpl&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Xiaokang2022/tkintertools-mpl&type=Date" />
</picture>
</a>
</p>
📦 Installation
---------------
```
pip install tkintertools-mpl
```
> [!IMPORTANT]
> `tkintertools`: https://github.com/Xiaokang2022/tkintertools
### 👀 Preview
![preview-1](./preview-1.png)
```python
import math
import matplotlib.figure
import numpy
import tkintertools
import tkintertools.mpl as mpl
import tkintertools.style as style
mpl.set_mpl_default_theme(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 = mpl.FigureCanvas(canvas, figure)
toolbar = mpl.FigureToolbar(canvas, figure_canvas)
figure_canvas.pack(side="top", fill="both", expand=True)
root.mainloop()
```
![preview-2](./preview-2.png)
```python
import matplotlib.figure
import numpy
import tkintertools
import tkintertools.mpl as mpl
import tkintertools.style as style
mpl.set_mpl_default_theme(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 = mpl.FigureCanvas(canvas, figure)
toolbar = mpl.FigureToolbar(canvas, figure_canvas)
figure_canvas.pack(side="top", fill="both", expand=True)
root.mainloop()
```
Raw data
{
"_id": null,
"home_page": null,
"name": "tkintertools-mpl",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Xiaokang2022 <2951256653@qq.com>",
"keywords": "tkinter, tkintertools, matplotlib, cross-platform, themed",
"author": null,
"author_email": "Xiaokang2022 <2951256653@qq.com>",
"download_url": "https://files.pythonhosted.org/packages/ad/be/7c0d64a5a92c40bd5593f7f8fe4533950e1e95ced3f8d64e5a33d4fba888/tkintertools_mpl-1.2.2.tar.gz",
"platform": null,
"description": "<h1 align=\"center\">tkintertools-mpl</h1>\r\n\r\n<p align=\"center\">Extension package for <code>tkintertools</code> to <code>matplotlib</code></p>\r\n\r\n<p align=\"center\">\r\n<a href=\"https://github.com/Xiaokang2022/tkintertools-mpl/releases\"><img alt=\"Version\" src=\"https://img.shields.io/github/v/release/Xiaokang2022/tkintertools-mpl?include_prereleases&logo=github&label=Version\" title=\"Latest Version\" /></a>\r\n<a href=\"https://pypistats.org/packages/tkintertools-mpl\"><img alt=\"Downloads\" src=\"https://img.shields.io/pypi/dm/tkintertools-mpl?label=Downloads&logo=pypi&logoColor=skyblue\" title=\"Downloads\" /></a>\r\n<a href=\"https://pepy.tech/project/tkintertools-mpl\"><img alt=\"Total Downloads\" src=\"https://img.shields.io/pepy/dt/tkintertools-mpl?logo=pypi&logoColor=gold&label=Total%20Downloads\" title=\"Total Downloads\" /></a>\r\n<a href=\"https://github.com/Xiaokang2022/tkintertools-mpl\"><img alt=\"Size\" src=\"https://img.shields.io/github/languages/code-size/Xiaokang2022/tkintertools-mpl?label=Size&logo=github\" title=\"Code Size\"/></a>\r\n<br/>\r\n<a href=\"https://github.com/Xiaokang2022/tkintertools-mpl/watchers\"><img alt=\"Watchers\" src=\"https://img.shields.io/github/watchers/Xiaokang2022/tkintertools-mpl?label=Watchers&logo=github&style=flat\" title=\"Watchers\" /></a>\r\n<a href=\"https://github.com/Xiaokang2022/tkintertools-mpl/forks\"><img alt=\"Forks\" src=\"https://img.shields.io/github/forks/Xiaokang2022/tkintertools-mpl?label=Forks&logo=github&style=flat\" title=\"Forks\" /></a>\r\n<a href=\"https://github.com/Xiaokang2022/tkintertools-mpl/stargazers\"><img alt=\"Stars\" src=\"https://img.shields.io/github/stars/Xiaokang2022/tkintertools-mpl?label=Stars&color=gold&logo=github&style=flat\" title=\"Stars\" /></a>\r\n<a href=\"https://github.com/Xiaokang2022/tkintertools-mpl/issues\"><img alt=\"Issues\" src=\"https://img.shields.io/github/issues/Xiaokang2022/tkintertools-mpl?label=Issues&logo=github\" title=\"Issues\" /></a>\r\n<a href=\"https://github.com/Xiaokang2022/tkintertools-mpl/pulls\"><img alt=\"Pull Requests\" src=\"https://img.shields.io/github/issues-pr/Xiaokang2022/tkintertools-mpl?label=Pull%20Requests&logo=github\" title=\"Pull Requests\" /></a>\r\n<a href=\"https://github.com/Xiaokang2022/tkintertools-mpl/discussions\"><img alt=\"Discussions\" src=\"https://img.shields.io/github/discussions/Xiaokang2022/tkintertools-mpl?label=Discussions&logo=github\" title=\"Discussions\" /></a>\r\n</p>\r\n\r\n<p align=\"center\">\r\n<a href=\"https://github.com/Xiaokang2022/tkintertools-mpl/pulse\"><img alt=\"Insights\" src=\"https://repobeats.axiom.co/api/embed/16b936d7774f2727ca057af76b700997a60c9b67.svg\" /></a>\r\n</p>\r\n\r\n<p align=\"center\">\r\n <a href=\"https://star-history.com/#Xiaokang2022/tkintertools-mpl&Date\">\r\n <picture>\r\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=Xiaokang2022/tkintertools-mpl&type=Date&theme=dark\" />\r\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=Xiaokang2022/tkintertools-mpl&type=Date\" />\r\n <img alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=Xiaokang2022/tkintertools-mpl&type=Date\" />\r\n </picture>\r\n </a>\r\n</p>\r\n\r\n\ud83d\udce6 Installation\r\n---------------\r\n\r\n```\r\npip install tkintertools-mpl\r\n```\r\n\r\n> [!IMPORTANT] \r\n> `tkintertools`: https://github.com/Xiaokang2022/tkintertools\r\n\r\n### \ud83d\udc40 Preview\r\n\r\n![preview-1](./preview-1.png)\r\n\r\n```python\r\nimport math\r\n\r\nimport matplotlib.figure\r\nimport numpy\r\n\r\nimport tkintertools\r\nimport tkintertools.mpl as mpl\r\nimport tkintertools.style as style\r\n\r\nmpl.set_mpl_default_theme(style.get_color_mode())\r\n\r\nx = numpy.linspace(-math.tau, math.tau, 100)\r\ny = numpy.sin(x)\r\n\r\nfigure = matplotlib.figure.Figure()\r\naxes = figure.add_subplot()\r\naxes.plot(x, y)\r\n\r\naxes.set(xlabel='x', ylabel='y', title='Plotting based on the theme in tkt')\r\naxes.legend([\"$y=sin(x)$\"])\r\naxes.grid()\r\n\r\nroot = tkintertools.Tk((960, 720), title=\"tkintertools-mpl\")\r\nroot.center()\r\ncanvas = tkintertools.Canvas(root, zoom_item=True)\r\ncanvas.place(width=960, height=720)\r\nfigure_canvas = mpl.FigureCanvas(canvas, figure)\r\ntoolbar = mpl.FigureToolbar(canvas, figure_canvas)\r\nfigure_canvas.pack(side=\"top\", fill=\"both\", expand=True)\r\n\r\nroot.mainloop()\r\n```\r\n\r\n![preview-2](./preview-2.png)\r\n\r\n```python\r\nimport matplotlib.figure\r\nimport numpy\r\n\r\nimport tkintertools\r\nimport tkintertools.mpl as mpl\r\nimport tkintertools.style as style\r\n\r\nmpl.set_mpl_default_theme(style.get_color_mode())\r\n\r\nfigure = matplotlib.figure.Figure()\r\naxes = figure.add_subplot(projection='3d')\r\n\r\ncolors = ['r', 'g', 'b', 'y']\r\nyticks = [3, 2, 1, 0]\r\n\r\nfor c, k in zip(colors, yticks):\r\n xs = numpy.arange(20)\r\n ys = numpy.random.rand(20)\r\n cs = [c] * len(xs)\r\n cs[0] = 'c'\r\n axes.bar(xs, ys, zs=k, zdir='y', color=cs, alpha=0.7)\r\n\r\naxes.set_xlabel('X')\r\naxes.set_ylabel('Y')\r\naxes.set_zlabel('Z')\r\naxes.set_title(\"3D plotting with interoperability\")\r\n\r\naxes.set_yticks(yticks)\r\n\r\nroot = tkintertools.Tk((960, 720), title=\"tkintertools-mpl\")\r\nroot.center()\r\ncanvas = tkintertools.Canvas(root, zoom_item=True)\r\ncanvas.place(width=960, height=720)\r\nfigure_canvas = mpl.FigureCanvas(canvas, figure)\r\ntoolbar = mpl.FigureToolbar(canvas, figure_canvas)\r\nfigure_canvas.pack(side=\"top\", fill=\"both\", expand=True)\r\n\r\nroot.mainloop()\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Extension package for tkintertools to matplotlib",
"version": "1.2.2",
"project_urls": {
"Bug tracker": "https://github.com/Xiaokang2022/tkintertools-mpl/issues",
"Source code": "https://github.com/Xiaokang2022/tkintertools-mpl"
},
"split_keywords": [
"tkinter",
" tkintertools",
" matplotlib",
" cross-platform",
" themed"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "06922e37602865f78bd7c7d0b9df0933119cafb4cdb36e95673438d3cb99e245",
"md5": "2ebf5705df6fb8b42443fa258073049e",
"sha256": "3317058863a5684324c5919e843bb13299ebff1f04bb322d9af912beb6e54a31"
},
"downloads": -1,
"filename": "tkintertools_mpl-1.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2ebf5705df6fb8b42443fa258073049e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 7529,
"upload_time": "2024-11-17T15:43:56",
"upload_time_iso_8601": "2024-11-17T15:43:56.102364Z",
"url": "https://files.pythonhosted.org/packages/06/92/2e37602865f78bd7c7d0b9df0933119cafb4cdb36e95673438d3cb99e245/tkintertools_mpl-1.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "adbe7c0d64a5a92c40bd5593f7f8fe4533950e1e95ced3f8d64e5a33d4fba888",
"md5": "bd8a36d7d114947e234803dc3de565bb",
"sha256": "8da852674c0bd979918ab9f9489284fe45faa6bf213ab86e92c703c34c4da41e"
},
"downloads": -1,
"filename": "tkintertools_mpl-1.2.2.tar.gz",
"has_sig": false,
"md5_digest": "bd8a36d7d114947e234803dc3de565bb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 8085,
"upload_time": "2024-11-17T15:43:57",
"upload_time_iso_8601": "2024-11-17T15:43:57.245239Z",
"url": "https://files.pythonhosted.org/packages/ad/be/7c0d64a5a92c40bd5593f7f8fe4533950e1e95ced3f8d64e5a33d4fba888/tkintertools_mpl-1.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-17 15:43:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Xiaokang2022",
"github_project": "tkintertools-mpl",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "tkintertools-mpl"
}