In [1]:
%matplotlib inline
a=[1,2,3,4,5]
b=[1,3,2.5,3,5]
import matplotlib.pyplot as plt
plt.plot(a,b,color='g',label='income')
plt.ylabel("Accounts")
plt.xlabel("Money")
plt.legend()
plt.show()
In [2]:
plt.figure(1)
plt.subplot(211)
plt.plot(a,b,'bo',a,b,'g')
plt.title("image 1")
plt.subplot(212)
plt.plot([5,10,15])
plt.figure(2)
#subplot rows,columns,plot number
plt.subplot(121)
plt.plot([1,2,4,5])
plt.subplot(122)
plt.plot(b,a,'ro',a,b,'k')
plt.title('image 2')
plt.show()
In [3]:
fig=plt.figure()
#plt.title('nice pictures')
ax1=fig.add_subplot(131)
ax2=fig.add_subplot(132)
ax3=fig.add_subplot(133)
ax1.bar([10,20,30],[3,5,8])
ax2.barh([10,20,30],[8,5,3])
ax3.scatter(a,b)
#fig.delaxes(ax3)
plt.savefig('hello.jpg')
plt.show()
In [4]:
import altair as alt
# to use with Jupyter notebook (not JupyterLab) run the following
# alt.renderers.enable('notebook')
# load a simple dataset as a pandas DataFrame
from vega_datasets import data
cars = data.cars()
cars.columns
Out[4]:
In [5]:
alt.Chart(cars).mark_point().encode(
x='Miles_per_Gallon',
y='Horsepower'
)
In [6]:
alt.Chart(cars).mark_bar().encode(
x='Origin',
y='Weight_in_lbs'
)
In [ ]: