Professional Documents
Culture Documents
: 04
Name: G Khirasindhu Redy Year: 3rd
Question 1:
Draw a scatter plot on crop production in India in year 2019 using Plotly.
Code:
import plotly.graph_objects as go
Season = ['Kharif', 'Rabi','Summer', 'Autumn', 'Winter']
Production = [303, 444, 507, 300 ,600]
fig = go.Figure(data=go.Bar(x=Season,y=Production))
fig.update_layout(title='Crop production in India in year 2019', xaxis_title="Season",
yaxis_title="Production")
fig.show()
Output:
Question 4:
Draw a horizontal bar plot on crop production in India in year 2019 using Plotly.
Code:
import plotly.graph_objects as go
Season = ['Kharif', 'Rabi','Summer', 'Autumn', 'Winter']
Production = [303, 444, 507, 300 ,600]
fig = go.Figure(data=go.Bar(x=Production,y=Season,orientation='h',
text=Production))
fig.update_traces(textposition='inside',textfont_size=14,
textfont_color='red')
fig.update_layout(title='Crop production in India in year 2019', xaxis_title="Production",
yaxis_title="Season")
fig.show()
Output:
Question 5:
Draw a pie chart on crop production in India in year 2019 using Plotly.
Code:
import plotly.graph_objects as go
Season = ['Kharif', 'Rabi','Summer', 'Autumn', 'Winter']
Production = [303, 444, 507, 300 ,600]
fig=go.Figure(data=[go.Pie(labels=Season, values=Production,
textinfo='label+percent')])
fig.show()
Output:
Question 6:
Draw a bubble plot on crop production in India in year 2019 using Plotly
Code:
import plotly.graph_objects as go
Season = ['Kharif', 'Rabi','Summer', 'Autumn', 'Winter']
Production = [303, 444, 507, 300 ,600]
fig = go.Figure(data=go.Scatter(x=Season,y=Production, mode='markers',marker_size=[50,60,
80, 40, 90]))
fig.update_layout(title='Crop production in India in year 2019', xaxis_title="Season",
yaxis_title="Production")
fig.show()
Output: