# Plots.Surface rescaling gives incorrect color legend

**URL:** <https://discourse.julialang.org/t/plots-surface-rescaling-gives-incorrect-color-legend/89381>\
**Category:** Visualization\
**Tags:** bug, plots, gr\
**Created:** [October 27, 2022, 4:02pm UTC](https://discourse.julialang.org/t/plots-surface-rescaling-gives-incorrect-color-legend/89381 "2022-10-27T16:02:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grace\_Chuan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/grace_chuan/32/35724_2.png) [@Grace\_Chuan](https://discourse.julialang.org/u/Grace_Chuan)\
**Post date:** [October 27, 2022, 4:02pm UTC](https://discourse.julialang.org/t/plots-surface-rescaling-gives-incorrect-color-legend/89381/1 "2022-10-27T16:02:54Z")

</div>

Hello, I am trying to plot a surface via Julia Plots. The maximum of the series I would like to plot along the z axis is 10. But I want the z axis to rescale to (0,20). When I add in the argument: zlim = (0,20), I get what I want but the color scale on the right hand side is incorrect. It should go from 0 to 20 but it still does 0 to 10. Therefore, the colors don’t match with the numbers being graphed. Here is my output:  
 ![3d_delta_20_30](https://global.discourse-cdn.com/julialang/original/3X/a/3/a3d09251fdcf4b79e7c53a0c710bbfa9eadcd386.png)

Is there a way to fix this? Thank you!

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [October 27, 2022, 5:42pm UTC](https://discourse.julialang.org/t/plots-surface-rescaling-gives-incorrect-color-legend/89381/2 "2022-10-27T17:42:47Z")

</div>

There is a related issue [reported here](https://github.com/JuliaPlots/Plots.jl/issues/3289) for the default Plots.jl `gr()` backend.

You can use any of the other backends with 3D plotting capability: `plotly()`, `plotlyjs()`, `pyplot()`, `gaston()` or `pgfplotsx()`.

The latter produces:

 ![Plots_pgfplotsx_surface_color_scale_clims_zlims](https://global.discourse-cdn.com/julialang/original/3X/8/a/8a65f185d415b3b3112aee4218cfb1a2aca36075.jpeg)

For such cliff-surfaces, `plotlyjs()` seems to handle color gradients quite well:

 ![Plots_plotlyjs_surface_zlims_clims](https://global.discourse-cdn.com/julialang/original/3X/f/c/fc20d4ec6d7ce4ff87a2e5defc1da26f572ac9bb.png)
