# Pie chart and dropdown multi-select

**URL:** <https://community.plotly.com/t/pie-chart-and-dropdown-multi-select/39871>\
**Category:** 📊 Plotly Python\
**Created:** [May 21, 2020, 4:14pm UTC](https://community.plotly.com/t/pie-chart-and-dropdown-multi-select/39871 "2020-05-21T16:14:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aleja1122](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Aleja1122](https://community.plotly.com/u/Aleja1122)\
**Post date:** [May 21, 2020, 4:14pm UTC](https://community.plotly.com/t/pie-chart-and-dropdown-multi-select/39871/1 "2020-05-21T16:14:27Z")

</div>

Hi everyone! (I’m not good at writing in English, I hope you understand)  
I need to do a dashboard with 4 dropdowns multiselect, but at the moment I am testing with only one.  
This is the structure of my data:  
 ![Captura](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/8/8611ac48711b6cf9644fa255718dd62cbb8b6912.png)

What I want to do is change the pie chart when I select one or more dropdown cities (CIUDAD). The Pd variable has 4 categories, and I plot the FACTOR variable in the piechart. I’ve managed to get it to change when the _multi = False dropdown_, but not when the _multi = True dropdown_

This is the code I’ve been trying, but it doesn’t work.

```auto
# -*- coding: utf-8 -*-
"""
Created on Thu May 7 15:58:14 2020

@author: aascencio
"""

import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import numpy as np
import pandas as pd
import dash_table

df = pd.read_csv(r'C:\Users\aascencio\Desktop\Proyectos\EGM\Observatorio\datos_EGMCuarentena _codigos.csv')
print(df.head())
df.columns

app = dash.Dash()

app.layout = html.Div([
    html.H1('EGM Cuarentena', style={'textAlign': 'center'}),
    html.Hr(),
    html.Div([
        html.Div([
            dcc.Dropdown(
                id='ciudad',
                options=[{'label': i, 'value': i} for i in df['CIUDAD'].unique()])
            ]),
        
        html.Div([
            dcc.Graph(
                id='pie'
                )
            ])
        ])
    ])

@app.callback(
    Output('pie', 'figure'),
    [Input('ciudad','value')])
def update_graph(ciudad):
    pie_data=df[df.CIUDAD==ciudad]
    traces=[]
    traces.append(go.Pie(
        labels=pie_data.PD,
        values=pie_data.FACTOR))
    figure=go.Figure(data=traces)
    return figure
      
if __name__ == ' __main__':
    app.run_server()

```

Thanks for your help!
