# Contour plot -R

**URL:** <https://community.plotly.com/t/contour-plot-r/85447>\
**Category:** Plotly R, MATLAB, Julia, Net\
**Created:** [June 28, 2024, 10:04am UTC](https://community.plotly.com/t/contour-plot-r/85447 "2024-06-28T10:04:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lalie](https://avatars.discourse-cdn.com/v4/letter/l/ccd318/32.png) [@lalie](https://community.plotly.com/u/lalie)\
**Post date:** [June 28, 2024, 10:04am UTC](https://community.plotly.com/t/contour-plot-r/85447/1 "2024-06-28T10:04:27Z")

</div>

Hello I would like to create contour plot with this dataset data\_Al. Now I would like to trace specific contours to represent when Al concentrations are above natural limits (threshold: 1.35 (min) and 4.35 (max)). Did you have any suggestions or can you help me please?  
I have to do same for others metals and some of them have different threshold for example for Co I have at 50m 0.008 (min), 0.016 (max) and at 300m 0.004 (min), 0.008 (max).

Thank you

data\_Al  
Nom\_Metal Depth Station C\_F C\_NF ratio Station\_ID  
1 Al 50 L1\_2016\_Dec 3.9277229728 3.9277229728 100.00000000 1  
2 Al 100 L1\_2016\_Dec 2.9465089790 3.4510276081 85.38062611 1  
3 Al 200 L1\_2016\_Dec 17.1638004712 28.7529068216 59.69414007 1  
4 Al 250 L1\_2016\_Dec 39.9059132292 254.0168419658 15.70994778 1  
5 Al 300 L1\_2016\_Dec 11.4667022202 16.4236208833 69.81835675 1  
55 Al 50 L1\_2017\_Jan 2.6503154062 3.4093746151 77.73611602 2  
56 Al 100 L1\_2017\_Jan 5.5689476237 5.5689476237 100.00000000 2  
57 Al 200 L1\_2017\_Jan 7.4032966440 11.4916709718 64.42315188 2  
58 Al 250 L1\_2017\_Jan 42.8354527847 369.3703725526 11.59688377 2  
59 Al 300 L1\_2017\_Jan 7.4403208406 20.8675905377 35.65491103 2  
110 Al 50 L1\_2017\_Jul 1.1111903681 1.7834559648 62.30545581 3  
111 Al 100 L1\_2017\_Jul 1.3419567651 1.5426517839 86.99025788 3  
112 Al 200 L1\_2017\_Jul 11.3210248729 12.4887450620 90.64981963 3  
113 Al 250 L1\_2017\_Jul 3.8473443073 4.7850836226 80.40286463 3  
114 Al 300 L1\_2017\_Jul 4.4178724766 6.1507786472 71.82623095 3  
162 Al 50 L1\_2017\_Aug 0.7860731377 0.8011084887 98.12318166 4  
163 Al 100 L1\_2017\_Aug 1.3318181823 1.3668913589 97.43409186 4  
164 Al 200 L1\_2017\_Aug 3.1192583743 3.1643785304 98.57412267 4  
165 Al 250 L1\_2017\_Aug 6.4888585122 9.7735235624 66.39221229 4  
166 Al 300 L1\_2017\_Aug 8.5066131267 13.2933939847 63.99128121 4  
217 Al 50 L1\_2019\_Oct 7.7728288387 8.8153500145 88.17379714 5  
218 Al 100 L1\_2019\_Oct 4.4319612198 6.1552388981 72.00307402 5  
219 Al 200 L1\_2019\_Oct 7.4287677643 13.1674427288 56.41769566 5  
220 Al 250 L1\_2019\_Oct 15.6710710651 22.9226578537 68.36498265 5  
221 Al 300 L1\_2019\_Oct 54.9703891336 52.2710775539 105.16406339 5  
271 Al 50 L1\_2020\_Aug 4.1877658427 35.9106862704 11.66161463 6  
272 Al 100 L1\_2020\_Aug 11.0921835239 15.2153555977 72.90124409 6  
273 Al 200 L1\_2020\_Aug 43.9188685949 42.4740475844 103.40165605 6  
274 Al 250 L1\_2020\_Aug 14.9489584248 14.9489584248 100.00000000 6  
275 Al 300 L1\_2020\_Aug 65.7508287995 65.7508287995 100.00000000 6  
326 Al 50 L1\_2021\_Oct 4.4275070942 7.7100852003 57.42487896 7  
327 Al 100 L1\_2021\_Oct 6.7695177161 8.4021079390 80.56927815 7  
328 Al 200 L1\_2021\_Oct 13.4941417362 16.3470708681 82.54776556 7  
329 Al 250 L1\_2021\_Oct 24.7883206587 28.4534127334 87.11897195 7  
330 Al 300 L1\_2021\_Oct 7.8482051031 40.7121765215 19.27729189 7

I wrote this code:

p ← plot\_ly(data\_Al, x = ~Station\_ID, y = ~-Depth, z = ~C\_F, type = “contour”,  
color = ~C\_F,  
contours = list(coloring = “heatmap”, showlabels = TRUE)) %\>%  
layout(xaxis = list(title = “Station ID”),  
yaxis = list(title = “Depth (m)”),  
legend = list(title = " Al Concentration"))

p
