# Is it possible to hide contour lines in Histogram2dContour() method for Python?

**URL:** https://community.plotly.com/t/is-it-possible-to-hide-contour-lines-in-histogram2dcontour-method-for-python/35911
**Category:** 📊 Plotly Python
**Created:** [March 6, 2020, 4:55pm UTC](https://community.plotly.com/t/is-it-possible-to-hide-contour-lines-in-histogram2dcontour-method-for-python/35911 "2020-03-06T16:55:46Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sugar\_donut](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sugar\_donut](https://community.plotly.com/u/sugar_donut)
#### Post date: [March 6, 2020, 4:55pm UTC](https://community.plotly.com/t/is-it-possible-to-hide-contour-lines-in-histogram2dcontour-method-for-python/35911/1 "2020-03-06T16:55:47Z")

</div>

Is it possible to hide the contour lines from the Histogram2dContour plot in this example?

> import plotly.graph\_objs as go
> 
> import numpy as np
> 
> t = np.linspace(-1,1.2,2000)  
> x = (t**3)+(0.3\*np.random.randn(2000))  
> y = (t**6)+(0.3\*np.random.randn(2000))
> 
> trace1 = go.Scatter(  
> x=x, y=y, mode=‘markers’, name=‘points’,  
> marker=dict(color=‘rgb(102,0,0)’, size=2, opacity=0.4)  
> )  
> trace2 = go.Histogram2dContour(  
> x=x, y=y, name=‘density’, ncontours=20,  
> colorscale=‘Hot’, reversescale=True, showscale=False  
> )  
> trace3 = go.Histogram(  
> x=x, name=‘x density’,  
> marker=dict(color=‘rgb(102,0,0)’),  
> yaxis=‘y2’  
> )  
> trace4 = go.Histogram(  
> y=y, name=‘y density’, marker=dict(color=‘rgb(102,0,0)’),  
> xaxis=‘x2’  
> )  
> data = [trace1, trace2, trace3, trace4]
> 
> layout = go.Layout(  
> showlegend=False,  
> autosize=False,  
> width=600,  
> height=550,  
> xaxis=dict(  
> domain=[0, 0.85],  
> showgrid=False,  
> zeroline=False  
> ),  
> yaxis=dict(  
> domain=[0, 0.85],  
> showgrid=False,  
> zeroline=False  
> ),  
> margin=dict(  
> t=50  
> ),  
> hovermode=‘closest’,  
> bargap=0,  
> xaxis2=dict(  
> domain=[0.85, 1],  
> showgrid=False,  
> zeroline=False  
> ),  
> yaxis2=dict(  
> domain=[0.85, 1],  
> showgrid=False,  
> zeroline=False  
> )  
> )
> 
> go.Figure(data=data, layout=layout)

 ![Screen Shot 2020-03-06 at 17.56.58](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/5/550065359a190d9a8f40d71e1fdc0ded04fc3070.png)

---

<div class="post-metadata">

### Author: ![empet](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@empet](https://community.plotly.com/u/empet)
#### Post date: [March 6, 2020, 5:29pm UTC](https://community.plotly.com/t/is-it-possible-to-hide-contour-lines-in-histogram2dcontour-method-for-python/35911/2 "2020-03-06T17:29:14Z")

</div>

Hi @sugar_donut,  
To get a `Histogram2dContour` without contour lines remove from trace2 definition, `ncontours=20`, and insert  
`contours_showlines=False`.

To get nicer 1d histograms, update layout as follows:

`fig.update_layout(bargap=0.015)`

---

<div class="post-metadata">

### Author: ![sugar\_donut](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sugar\_donut](https://community.plotly.com/u/sugar_donut)
#### Post date: [March 7, 2020, 10:19am UTC](https://community.plotly.com/t/is-it-possible-to-hide-contour-lines-in-histogram2dcontour-method-for-python/35911/3 "2020-03-07T10:19:17Z")

</div>

Ah okay, no wonder because there is no `contours_showlines` argument in the doc! Thanks so much and also for the update layout tip!

---

<div class="post-metadata">

### Author: ![empet](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@empet](https://community.plotly.com/u/empet)
#### Post date: [March 7, 2020, 11:57am UTC](https://community.plotly.com/t/is-it-possible-to-hide-contour-lines-in-histogram2dcontour-method-for-python/35911/4 "2020-03-07T11:57:54Z")

</div>

@sugar_donut Have you searched the docs at [https://plot.ly/python/reference/](https://plot.ly/python/reference/) ???

See here : [https://plot.ly/python/reference/#histogram2dcontour-contours-showlines](https://plot.ly/python/reference/#histogram2dcontour-contours-showlines)

---

<div class="post-metadata">

### Author: ![sugar\_donut](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sugar\_donut](https://community.plotly.com/u/sugar_donut)
#### Post date: [March 7, 2020, 1:26pm UTC](https://community.plotly.com/t/is-it-possible-to-hide-contour-lines-in-histogram2dcontour-method-for-python/35911/5 "2020-03-07T13:26:37Z")

</div>

I did but it was hard to navigate around because it’s a long list, that’s kinda unstructured, and none of the keywords I used pulled it up.
