Embed an interactive 3D plot in PyQt5


Headnotes

Many equations and formulas look intimidating. However, when you hunt them down, they are definitely not! Just papertigers!

Now let's hunt the papertiger.

https://stackoverflow.com/questions/18259350/embed-an-interactive-3d-plot-in-pyside/18278457#18278457%20…

1) Create the FigureCanvas before adding the axes. See https://stackoverflow.com/a/9007892/3962328

canvas = FigureCanvas(fig)
ax = figure.add_subplot(111, projection='3d')

or

class MyFigureCanvas(FigureCanvas):
    def __init__(self):
        self.figure = Figure()
        super(FigureCanvas, self).__init__(self.figure)
        self.axes = self.figure.add_subplot(111, projection='3d')

2) Try ax.mouse_init() to restore the connection:

...
ax = fig.gca(projection="3d")
...
canvas = FigureCanvas(fig)
ax.mouse_init()

Footnotes

There are many excellent tutorials out there. Some tutorials are too intuitive and it's helpful, but you cannot get it straight on the math details. Some focused on dymestifying math. Some focused on code. I found the best tutorials that give you the conceptual ideas and are possible for implementation without being blind to the math details. Drop a comment if I failed. It would be really appreciable.


If you want to cite this article, please cite this article as:

Lachlan Chen, "Embed an interactive 3D plot in PyQt5," in EarnFromScratch, 五月 1, 2019, https://www.earnfs.com/zh/html/1929.htm.

or

@misc{lachlanchen2020tutorial,
title=Embed an interactive 3D plot in PyQt5,
author={Chen, Lachlan},
year=五月 1, 2019
}


EarnFromScratch (九月 30, 2020) Embed an interactive 3D plot in PyQt5. Retrieved from https://www.earnfs.com/zh/html/1929.htm.
"Embed an interactive 3D plot in PyQt5." EarnFromScratch - 九月 30, 2020, https://www.earnfs.com/zh/html/1929.htm
EarnFromScratch 五月 1, 2019 Embed an interactive 3D plot in PyQt5., viewed 九月 30, 2020,<https://www.earnfs.com/zh/html/1929.htm>
EarnFromScratch - Embed an interactive 3D plot in PyQt5. [Internet]. [Accessed 九月 30, 2020]. Available from: https://www.earnfs.com/zh/html/1929.htm
"Embed an interactive 3D plot in PyQt5." EarnFromScratch - Accessed 九月 30, 2020. https://www.earnfs.com/zh/html/1929.htm
"Embed an interactive 3D plot in PyQt5." EarnFromScratch [Online]. Available: https://www.earnfs.com/zh/html/1929.htm. [Accessed: 九月 30, 2020]


发表评论