matplotlib - Empty graph when I "save as" with Plotly in Python -


i'm new using plot.ly in python. want save python multiples bubble graphs. when i'm trying save graph, empty, has axis data, content (the main data) empty in graph (not in variable).

i'm using same method in other graphs working well.

the way how save image is:

fig = figure(data=data, layout=layout) #plot_url = py.plot(fig) py.image.save_as(fig, './images/upsdowns_'+str(individual_data['id'])+'.png') 

the complete code is:

for individual_data in individual:  arraydata = [] particular_point = false points in arraypoints:      trace = scatter(         x = points['down'],         y = points['up'],         mode = 'markers',         name = 'name',         text = ['text'],         marker = marker(             color='rgba(40, 120, 200, 0.5)',             size = points['total'] * 10         )     )     arraydata.append(trace)      if points['up'] == individual_data['pups'] , not particular_point:         trace2 = scatter(                 x = points['down'],                 y = points['up'],                 mode = 'markers',                 name = 'name',                 text = ['text'],                 marker = marker(                     color='rgba(200, 120, 40, 0.5)',                     size = 10                 )         )         arraydata.append(trace2)         particular_point = true   data = data(arraydata)  layout = layout(     title='total users choice',     titlefont=font(         family='',         size=20,         color=''     ),     font=font(         family='"pt sans narrow", sans-serif',         size=14,         color='#000'     ),     showlegend=false,     autosize=false,     width=600,     height=500,     xaxis=xaxis(         title='down',         titlefont=font(             family='',             size=0,             color=''         ),         range=[0, 100],         domain=[0, 1],         type='linear',         rangemode='normal',         autorange=false,         showgrid=true,         zeroline=false,         showline=false,         autotick=true,         nticks=12,         ticks='',         showticklabels=true,         tick0=0,         dtick=1,         ticklen=5,         tickwidth=1,         tickcolor='#000',         tickangle='auto',         tickfont=font(             family='',             size=0,             color=''         ),         exponentformat='e',         showexponent='all',         mirror='all',         gridcolor='#ddd',         gridwidth=1,         zerolinecolor='#000',         zerolinewidth=1,         linecolor='white',         linewidth=1,         anchor='y',         overlaying=false,         position=0     ),     yaxis=yaxis(         title='up',         titlefont=font(             family='',             size=0,             color=''         ),         range=[0, 100],         domain=[0, 1],         type='linear',         rangemode='normal',         showgrid=true,         zeroline=false,         showline=false,         autotick=true,         nticks=12,         ticks='',         showticklabels=true,         tick0=0,         dtick=100,         ticklen=5,         tickwidth=1,         tickcolor='#000',         tickangle='auto',         tickfont=font(             family='',             size=0,             color=''         ),         exponentformat='e',         showexponent='all',         mirror='all',         gridcolor='#ddd',         gridwidth=1,         zerolinecolor='#000',         zerolinewidth=1,         linecolor='white',         linewidth=1,         anchor='x',         overlaying=false,         position=0     ),     legend=legend(         traceorder='normal',         font=font(             family='',             size=0,             color=''         ),         bgcolor='#fff',         bordercolor='#000',         borderwidth=1     ),     margin=margin(         l=80,         r=80,         b=80,         t=100,         pad=2     ),     paper_bgcolor='rgb(245, 245, 245)',     plot_bgcolor='rgb(245, 245, 245)',     hovermode='closest',     dragmode='zoom',     separators='.,',     barmode='stack',     bargap=0.2,     bargroupgap=0,     boxmode='overlay',     boxgap=0.3,     boxgroupgap=0.3 ) fig = figure(data=data, layout=layout) #plot_url = py.plot(fig) py.image.save_as(fig, './images/upsdowns_'+str(individual_data['id'])+'.png') 


Comments