# Plotting in pyplot: z coordinate always becomes zero when plotted using the scatter when xlims,ylims and zlims are given

**URL:** https://discourse.julialang.org/t/plotting-in-pyplot-z-coordinate-always-becomes-zero-when-plotted-using-the-scatter-when-xlims-ylims-and-zlims-are-given/47255
**Category:** General Usage
**Tags:** question, plotting
**Created:** [September 25, 2020, 11:16am UTC](https://discourse.julialang.org/t/plotting-in-pyplot-z-coordinate-always-becomes-zero-when-plotted-using-the-scatter-when-xlims-ylims-and-zlims-are-given/47255 "2020-09-25T11:16:54Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![manvibharat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manvibharat/32/11635_2.png) [@manvibharat](https://discourse.julialang.org/u/manvibharat)
#### Post date: [September 25, 2020, 11:16am UTC](https://discourse.julialang.org/t/plotting-in-pyplot-z-coordinate-always-becomes-zero-when-plotted-using-the-scatter-when-xlims-ylims-and-zlims-are-given/47255/1 "2020-09-25T11:16:54Z")

</div>

The package used is pyplot:  
using Plots; pyplot()

This plot  
scatter3d([0],[1],[100], xlims=(-100,100),ylims=(-100,100), zlims=(-100,100),c=:red,markersize=5)  
and also this plot  
scatter3d([0],[1],[100], xlims=(-100,100),ylims=(-100,100), zlims=(-100,100),c=:red,markersize=5)

when plotted will make z coordinate to zero.

I am using Julia 1.5.0. This problem started occurring once my project.toml got wiped (my mistake). But I installed the same packages from start but the problem still persists. Any help would be much appreciated since I need this for my publication which is in just two days. For clarification, this was working before I did that mistake of wiping the project.toml.

---

<div class="post-metadata">

### Author: ![tomerarnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomerarnon/32/3170_2.png) [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)
#### Post date: [September 25, 2020, 11:40am UTC](https://discourse.julialang.org/t/plotting-in-pyplot-z-coordinate-always-becomes-zero-when-plotted-using-the-scatter-when-xlims-ylims-and-zlims-are-given/47255/2 "2020-09-25T11:40:09Z")

</div>

I’m seeing the same behavior as you with PyPlot, but not with GR or PGFPlots or PGFPlotsX, so it seems like you have options! 😁

---

<div class="post-metadata">

### Author: ![manvibharat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manvibharat/32/11635_2.png) [@manvibharat](https://discourse.julialang.org/u/manvibharat)
#### Post date: [September 25, 2020, 12:10pm UTC](https://discourse.julialang.org/t/plotting-in-pyplot-z-coordinate-always-becomes-zero-when-plotted-using-the-scatter-when-xlims-ylims-and-zlims-are-given/47255/4 "2020-09-25T12:10:27Z")

</div>

- Yeah. But this was part of the animation which I was doing, I tried plotlyjs for that animation, but the xlims, ylims and zlims aren’t working there. So that animation does not look good.

- the package I used is this- using Plots; plotlyjs(),

- Tried gr() also for this but the look of the animation is not that great.

- For the animation, I am using “anim” from plots.jl to save as gif.

So any ideas on fixing the x,y,z limits in plotlyjs().

---

<div class="post-metadata">

### Author: ![tomerarnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomerarnon/32/3170_2.png) [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)
#### Post date: [September 25, 2020, 12:22pm UTC](https://discourse.julialang.org/t/plotting-in-pyplot-z-coordinate-always-becomes-zero-when-plotted-using-the-scatter-when-xlims-ylims-and-zlims-are-given/47255/5 "2020-09-25T12:22:42Z")

</div>

I don’t have any experience with plotlyjs. Can you be more specific about what didn’t look good vs. what you wanted to see?

---

<div class="post-metadata">

### Author: ![manvibharat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manvibharat/32/11635_2.png) [@manvibharat](https://discourse.julialang.org/u/manvibharat)
#### Post date: [September 25, 2020, 12:30pm UTC](https://discourse.julialang.org/t/plotting-in-pyplot-z-coordinate-always-becomes-zero-when-plotted-using-the-scatter-when-xlims-ylims-and-zlims-are-given/47255/6 "2020-09-25T12:30:35Z")

</div>

Sorry about that. Looking good means that the axes(x,y,z) are not visible properly (May it is always the case with gr()). Thanks for pointing out to other packages. 👍. At least its working.

---

<div class="post-metadata">

### Author: ![tomerarnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomerarnon/32/3170_2.png) [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)
#### Post date: [September 25, 2020, 12:34pm UTC](https://discourse.julialang.org/t/plotting-in-pyplot-z-coordinate-always-becomes-zero-when-plotted-using-the-scatter-when-xlims-ylims-and-zlims-are-given/47255/7 "2020-09-25T12:34:42Z")

</div>

There’s all kinds of way to customize the axes, so whatever problems you’re seeing may be fixable.

---

<div class="post-metadata">

### Author: ![manvibharat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manvibharat/32/11635_2.png) [@manvibharat](https://discourse.julialang.org/u/manvibharat)
#### Post date: [September 26, 2020, 6:26am UTC](https://discourse.julialang.org/t/plotting-in-pyplot-z-coordinate-always-becomes-zero-when-plotted-using-the-scatter-when-xlims-ylims-and-zlims-are-given/47255/8 "2020-09-26T06:26:58Z")

</div>

Yeah. I am able to customize the axis. I used xticks ,yticks and zticks. it looks well with grid. Is this how we enable the grids in the plot right?

---

<div class="post-metadata">

### Author: ![tomerarnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomerarnon/32/3170_2.png) [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)
#### Post date: [September 26, 2020, 10:58am UTC](https://discourse.julialang.org/t/plotting-in-pyplot-z-coordinate-always-becomes-zero-when-plotted-using-the-scatter-when-xlims-ylims-and-zlims-are-given/47255/9 "2020-09-26T10:58:12Z")

</div>

If it worked, then yes…!  
Here is a full list of attributes you can manipulate. Most backends support most of them (but not all).  
[https://docs.juliaplots.org/latest/generated/attributes\_axis/](https://docs.juliaplots.org/latest/generated/attributes_axis/)
