# Offline iplots in plotly with python

**URL:** <https://community.plotly.com/t/offline-iplots-in-plotly-with-python/4333>\
**Category:** 📊 Plotly Python\
**Created:** [May 24, 2017, 12:41pm UTC](https://community.plotly.com/t/offline-iplots-in-plotly-with-python/4333 "2017-05-24T12:41:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PauloP](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@PauloP](https://community.plotly.com/u/PauloP)\
**Post date:** [May 24, 2017, 12:41pm UTC](https://community.plotly.com/t/offline-iplots-in-plotly-with-python/4333/1 "2017-05-24T12:41:32Z")

</div>

Hi,

I’m new to ploytly. I’m experiencing some issues (blank plot) using offline plot options with plotly and python. I followed some suggestions as in [https://community.plotly.com/t/offline-mode-in-jupyter-notebook-shows-blank-graphs/1860](https://community.plotly.com/t/offline-mode-in-jupyter-notebook-shows-blank-graphs/1860). but without sucess. My plotly version is `1.12.19` and my phyton version is `3.6.0.`

I did some modifications in the Color Palette for Bar Chart example contained in [https://plot.ly/python/horizontal-bar-charts/](https://plot.ly/python/horizontal-bar-charts/). My online plot works fine when I try :

```
 fig = go.Figure(data=traces, layout=layout)
 plotly.iplot(fig, filename='bar-colorscale')

```

However, if I try :

```
fig = go.Figure(data=traces, layout=layout)
plotly.offline.iplot(fig, filename='bar-colorscale')  

```

or  
`plotly.offline.plot(fig, filename='bar-colorscale')`

The result is a blank plot, with plotly api and x and y axis :

 ![](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/b/b59bce661cb76344b823acea5b6a3c102ba2c7d2.png)

I tried a simple test with plotly.offline.plot using :

```
trace = go.Bar(x=[2, 4, 6], y= [10, 12, 15])
data = [trace]
layout = go.Layout(title='A Simple Plot', width=800, height=640)
fig = go.Figure(data=data, layout=layout)
plotly.offline.plot(fig, filename='a-simple-plot') 

```

And it works perfectly. So I believe that the issue is in `fig`. In the Color Palette for Bar Chart example, `fig` has a list of `traces` (stacked bar). But in the test example above, `trace` is a single graphic object (go) element.

Is there a way to make a offline plot from a trace that contains many graphic objects (as showed in the Color Palette for Bar Chart example )? Or maybe I’m doing something else wrong ?

Thank you

Paulo

---

<div class="post-metadata">

**Author:** ![chelsea](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chelsea/32/196_2.png) [@chelsea](https://community.plotly.com/u/chelsea)\
**Post date:** [May 29, 2017, 7:18pm UTC](https://community.plotly.com/t/offline-iplots-in-plotly-with-python/4333/2 "2017-05-29T19:18:15Z")

</div>

Hi there,  
Could you include the code for the example that isn’t working for you (maybe I misunderstood but it looks like you just included the code that is working for you). Could you also see if this issue persists on an upgraded version of the API, we’re not currently on version 2.0.8.

---

<div class="post-metadata">

**Author:** ![zhsee](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/zhsee/32/3384_2.png) [@zhsee](https://community.plotly.com/u/zhsee)\
**Post date:** [June 17, 2018, 5:19am UTC](https://community.plotly.com/t/offline-iplots-in-plotly-with-python/4333/3 "2018-06-17T05:19:20Z")

</div>

I try to copy exactly the same code in the example and it is not working. i believe this is regardless offline or online plot. the guess the problem lie in the ‘traces’ assignment below:

> for i in range(0, len(x\_data[0])):  
> for xd, yd in zip(x\_data, y\_data):  
> traces.append(go.Bar(  
> x=xd[i],  
> y=yd,  
> orientation=‘h’,  
> marker=dict(  
> color=colors[i],  
> line=dict(  
> color=‘rgb(248, 248, 249)’,  
> width=1)  
> )  
> ))
