# Formatting 3D subplots in pyplot

**URL:** <https://discourse.julialang.org/t/formatting-3d-subplots-in-pyplot/4375>\
**Category:** New to Julia\
**Created:** [June 20, 2017, 4:23pm UTC](https://discourse.julialang.org/t/formatting-3d-subplots-in-pyplot/4375 "2017-06-20T16:23:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dabeanmonger](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@dabeanmonger](https://discourse.julialang.org/u/dabeanmonger)\
**Post date:** [June 20, 2017, 4:23pm UTC](https://discourse.julialang.org/t/formatting-3d-subplots-in-pyplot/4375/1 "2017-06-20T16:23:16Z")

</div>

I’ve run code which creates the following figure:  
 ![](https://global.discourse-cdn.com/julialang/original/3X/a/f/af85bd34e5396d8bfa2bc705140d71d1d13a5d5b.png)  
Now I want to make a 2 by 2 matrix of subplots showing the same figure from multiple views. My first problem is whether or not it’s possible to simply copy the same figure as opposed to drawing it on each subplot individually. After some research it seems like this isn’t possible and I’m just going to have to live with the slight lag as it loops through the code. If this is incorrect, someone please enlighten me.  
The other problem is when I try to draw the figure on a subplot using the same code used to produce the figure above, the formatting no longer works. For reference here’s my formatting code:  
ax=gca()  
ax[:set\_ylim]]([-limit_2/3,limit_4/3])  
ax[:set\_zlim]]([-limit,limit])  
ax[:set\_xlim]]([-limit,limit])  
ax:tick\_params  
ax[:set\_axis\_off]]()  
\*note that I added brackets to prevent the commenter from misinterpreting my code as hypertext  
And here’s the figure the for loop produces:  
 ![](https://global.discourse-cdn.com/julialang/original/3X/e/2/e27ee6a324d883b75a59299a6a94425672259cd6.png)

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [June 20, 2017, 5:06pm UTC](https://discourse.julialang.org/t/formatting-3d-subplots-in-pyplot/4375/2 "2017-06-20T17:06:38Z")

</div>

Sorry, this reply isn’t helpful - it just reminded me that something similar can be done in GLVisualize in what I find to be a very impressive demonstration: [interactive volume plots on Vimeo](https://vimeo.com/180307247)

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [June 21, 2017, 3:00am UTC](https://discourse.julialang.org/t/formatting-3d-subplots-in-pyplot/4375/3 "2017-06-21T03:00:38Z")

</div>

Following one of the examples [here](https://gist.github.com/gizmaa/7214002) you can try something like this:

```julia
fig=figure()
ax1=fig[:add_subplot](2,1,1,projection="3d")
ax1[:plot_wireframe](x,y,z)
ax1[:set_axis_off]()
ax2=fig[:add_subplot](2,1,2,projection="3d")
ax2[:plot_wireframe](x,y,z)
ax2[:set_axis_off]()

```

Yes, the API is inconsistent (with single plots or 2D), because, well, it’s the Pythonic way?

For future reference, just put verbatim Julia code in sections fenced by triple backticks (see under Github Markdown). HTH

---

<div class="post-metadata">

**Author:** ![dabeanmonger](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@dabeanmonger](https://discourse.julialang.org/u/dabeanmonger)\
**Post date:** [June 21, 2017, 7:19pm UTC](https://discourse.julialang.org/t/formatting-3d-subplots-in-pyplot/4375/4 "2017-06-21T19:19:38Z")

</div>

Thank You!
