Untitled

 avatar
unknown
python
3 years ago
1.0 kB
3
Indexable

# coding: utf-8

# In[4]:


import matplotlib.pyplot as plt
from matplotlib import figure
import pandas as pd

fig = plt.figure(figsize=(5,4))

x=[1,2,3,4]
y=[5,6,7,8]

plt.xlabel("x-axis")
plt.ylabel("y-axis")
plt.title("Title")

plt.show()


# In[59]:


import matplotlib.pyplot as plt
from matplotlib import figure
import pandas as pd

data = {
        'year' : ['2018','2019','2020','2021'],
        'quantity' : [58000,70000,93000,69000]
       }

df = pd.DataFrame(data)

x = df['year']
y = df['quantity']

plt.plot(x,y)
plt.pie(y,labels=x)

# plt.bar(x,y)
plt.show()


# In[58]:


import matplotlib.pyplot as plt
from matplotlib import figure
import pandas as pd

df = pd.read_csv('example.csv')

plt.xlabel("emp_name")
plt.ylabel("emp_salary")
plt.title("Details")

print(df)

x = df['name']
y = df['salary']

plt.plot(x,y)
plt.pie(y,labels=x)

fig = plt.figure(figsize=(10,4))

plt.bar(x,y)
plt.show()


# In[69]:


x=[9,8,3]
y=[3,2,1]
z=[1,3,10]
plt.figure()
plt.subplot(231)
plt.plot(x,y)
plt.subplot(212)
plt.plot(z,y)

Editor is loading...