Generation

generate functionWed, 22 Feb 2023

Modify this code to make a vertical bar graph instead of a pie chart (plotly.express library) question6 = "How likely would you work for a company whose mission is not bringing social impact ?" question6 = data[question6].value_counts() label = question6.index counts = question6.values colors = ['gold','lightgreen'] fig = go.Figure(data=[go.Pie(labels=label, values=counts)]) fig.update_layout(title_text='How likely would you work for a company whose mission is not bringing social impact?') fig.update_traces(hoverinfo='label+value', textinfo='percent', textfont_size=30, marker=dict(colors=colors, line=dict(color='black', width=3))) fig.show()

def vertical_bar_chart(question): question = data[question].value_counts() label = question.index counts = question.values colors = ['gold', 'lightgreen'] fig = go.Figure(data=[go.Bar(x=label, y=counts, marker_color=colors)]) fig.update_layout(title_text=question) fig.show() vertical_bar_chart(question6)

Questions about programming?Chat with your personal AI assistant