Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Plotly子图组合重叠图和单个图_Python_Python 3.x_Plotly_Plotly Dash - Fatal编程技术网

Python 使用Plotly子图组合重叠图和单个图

Python 使用Plotly子图组合重叠图和单个图,python,python-3.x,plotly,plotly-dash,Python,Python 3.x,Plotly,Plotly Dash,我希望在两个子地块位置放置3个地块。第一个位置(行=1,列=1)带有trace\u choropleth&trace\u scattergeo,第二个位置(行=1,列=2)带有trace\u条形图。运行以下代码时收到的错误是: ValueError: The 'specs' argument to make_subplots must be a 2D list of dictionaries with dimensions (1 x 2). Received value of type

我希望在两个子地块位置放置3个地块。第一个位置(行=1,列=1)带有
trace\u choropleth&trace\u scattergeo
,第二个位置(行=1,列=2)带有
trace\u条形图。运行以下代码时收到的错误是:

ValueError: 
The 'specs' argument to make_subplots must be a 2D list of dictionaries with dimensions (1 x 2).
    Received value of type <class 'list'>: [[{'type': 'choropleth'}, {'type': 'scattergeo'}], {'type': 'bar'}]
marker = dict(
    colorscale = ['#FF0000','#FFFF00','#008000'],
    cmin = -1,
    cmax = 1)

fig = make_subplots(
    rows = 1, cols = 2,
    specs = [[{'type':'choropleth'},{'type': 'scattergeo'}], {'type':'bar'}])
trace_choropleth = go.Choropleth(
                locations = df_grouped_week['Origin_State'], 
                z = df_grouped_week['YoY'],
                hovertemplate = df_grouped_week['text'],
                zmin = -1,
                zmax = 1,
                locationmode = 'USA-states',
                colorscale = 'rdylgn',
                colorbar_title = "Year over Year Growth"
                )
trace_scattergeo = go.Scattergeo(
                lon = df['Longitude_dest'],
                lat = df['Latitude_dest'],
                hovertemplate = df['text'],
                mode = 'markers',
                marker_color = df['Type'],
                marker_size = df['Conversions']
                )
trace_barchart = go.Bar(
                x = df['City'][0:30].values,
                y = df['Conversions'][0:30].values,
                marker = marker,
                hovertemplate = df['text'][0:30].values,
                marker_color = df['Type'][0:30].values
                )
data = [trace_choropleth, trace_scattergeo]
fig.add_trace(data, row = 1, col = 1)
fig.add_trace(trace_barchart, row = 1, col = 2)        
iplot(fig)