You are on page 1of 7

Assignment No.

: 04
Name: G Khirasindhu Redy Year: 3rd

Registration No.: 180101120053 Section: Group-2

Branch: Computer Science Campus: PKD

Aim of the Experiment: Assignment of Plotly

Software Required: Jupyter Notebook

Crop production in India in year 2019


Season Kharif Rabi Summer Autumn Winter

Productio 303 444 507 300 600


n (in Ton)

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.Scatter(x=Season,y=Production, mode='markers'))


fig.update_layout(title='Crop production in India in year 2019', xaxis_title="Season",
yaxis_title="Production")
fig.show()
Output:
Question 2:
Draw a line 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='lines+markers'))


fig.update_layout(title='Crop production in India in year 2019', xaxis_title="Season",
yaxis_title="Production")
fig.show()
Output:
Question 3:
Draw a 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=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:

You might also like