3

I am using MPL toolkit to plot a 3d projection in python3 environment. I am able to visualize a nice interactive 3D scatter plot with this code

from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure(figsize=(15, 12))
ax = fig.add_subplot(111, projection='3d')
ax.scatter(dimension1, dimension2, dimension3, c='r', marker='o') 
plt.show()

Whenever I want to visualize my data, I need to run above script. I am wondering is there any way I can save this interactive 3d plot for sharing it with others or a quick review?

I found similar questions and most of the answer suggests to use pickle, but again I need to open the pickle file using a python script! But I am looking for something which can be useful to save 3D plot as an interactive image.

Deep
  • 616
  • 1
  • 9
  • 17
  • Would a 3d animation be good enough, or does it have to be interactive? – Stephen Meschke Apr 22 '19 at 18:37
  • You necessarily need python to show a matplotlib figure interactively. (Similar to how you need a pdf reader to view a pdf file). Maybe your best bet is to share a link to a webpage which has python running server-side? – ImportanceOfBeingErnest Apr 22 '19 at 19:40
  • @StephenMeschke 3d animation would be good i guess. Any pointers on how to create a 3d animation or a gif for the same? – Deep Apr 22 '19 at 19:48
  • @ImportanceOfBeingErnest I will look into that. Thank you for the suggestion. – Deep Apr 22 '19 at 19:49
  • 1
    Oh, so if an animation is enough, [here](https://matplotlib.org/gallery/animation/random_walk.html) is how to create an animation, [here](https://matplotlib.org/gallery/animation/simple_anim.html) is how you save one as mp4, change to `ani.save("movie.gif", writer="imagemagick")` for animated gif. In total that would probably be a duplicate of [this question](https://stackoverflow.com/questions/18344934/animate-a-rotating-3d-graph-in-matplotlib). – ImportanceOfBeingErnest Apr 22 '19 at 19:57
  • @ImportanceOfBeingErnest thank you for your response. I will try it out. – Deep Apr 25 '19 at 22:20

0 Answers0