# Why does setting the color limits in julia not change my heatmap?

**URL:** <https://community.plotly.com/t/why-does-setting-the-color-limits-in-julia-not-change-my-heatmap/76699>\
**Category:** Plotly R\
**Tags:** question\
**Created:** [July 6, 2023, 10:50am UTC](https://community.plotly.com/t/why-does-setting-the-color-limits-in-julia-not-change-my-heatmap/76699 "2023-07-06T10:50:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rikkie567](https://avatars.discourse-cdn.com/v4/letter/r/e9bcb4/32.png) [@rikkie567](https://community.plotly.com/u/rikkie567)\
**Post date:** [July 6, 2023, 10:50am UTC](https://community.plotly.com/t/why-does-setting-the-color-limits-in-julia-not-change-my-heatmap/76699/1 "2023-07-06T10:50:59Z")

</div>

Hi,

I cannot manage to change the color limits of my plotly heatmap in julia.  
I have tried the following options, but none seem to work:

> using PlotlyJS
> 
> function makePlot1()  
> n = 40  
> m = 50  
> data = rand(n, m)  
> display(plot(heatmap(  
> x = 1:m,  
> y = 1:n,  
> z = data,  
> cmax = 0.5)  
> , Layout()))  
> end
> 
> function makePlot2()  
> n = 40  
> m = 50  
> data = rand(n, m)  
> display(plot(heatmap(  
> x = 1:m,  
> y = 1:n,  
> z = data,  
> coloraxis = attr(  
> cmax = 0.5  
> ))  
> , Layout()))  
> end
> 
> function makePlot3()  
> n = 40  
> m = 50  
> data = rand(n, m)  
> display(plot(heatmap(  
> x = 1:m,  
> y = 1:n,  
> z = data)  
> , Layout(cmax = 0.5)))  
> end
> 
> function makePlot4()  
> n = 40  
> m = 50  
> data = rand(n, m)  
> display(plot(heatmap(  
> x = 1:m,  
> y = 1:n,  
> z = data)  
> , Layout(coloraxis = attr(cmax = 0.5))))  
> end
> 
> makePlot1()  
> makePlot2()  
> makePlot3()  
> makePlot4()

I found the cmax keyword on [Layout.coloraxis in Julia](https://plotly.com/julia/reference/layout/coloraxis/). I tried changing reversescale to true to see whether the keys are at the right place. The following call to reversescale seems to work:

> using PlotlyJS
> 
> function makePlot1()  
> n = 40  
> m = 50  
> data = zeros(n, m)  
> for i in 1:n  
> for j in 1:m  
> data[i, j] = i \* j  
> end  
> end  
> display(plot(heatmap(  
> x = 1:m,  
> y = 1:n,  
> z = data,  
> cmax = m,  
> reversescale = true)  
> , Layout()))  
> end
> 
> makePlot1()

However, the colorlimits still do not change.  
What am I doing wrong? How should I set my color limits? Is there a bug or is the documentation simply not correct?  
I am at a loss here.
