Generation

generate functionWed, 22 Feb 2023

Modify this code to make a horizontal bar graph instead of a vertical (plotly.express library) question6 = 'What is the most preferred working environment for you.' question6 = df[question6].value_counts() label = question6.index counts = question6.values fig = go.Figure(data=[go.Bar(x=label, y=counts)]) fig.update_layout(title_text='Какая рабочая среда для вас наиболее предпочтительна?') fig.show()

import plotly.express as px def horizontal_bar(question, title): question = df[question].value_counts() label = question.index counts = question.values fig = px.bar(x=label, y=counts, orientation='h') fig.update_layout(title_text=title) fig.show() horizontal_bar('What is the most preferred working environment for you?', 'Какая рабочая среда для вас наиболее предпочтительна?')

Questions about programming?Chat with your personal AI assistant