Está en la página 1de 7

from matplotlib import pyplot

import numpy
%matplotlib inline

x= numpy.arange(10)
y= x**2

pyplot.figure()
pyplot.plot(x,y)
pyplot.show()

pyplot.figure()
pyplot.plot(x,y,".")
pyplot.show()

pyplot.figure()
pyplot.plot(x,y,":")
pyplot.show()

pyplot.figure()
pyplot.plot(x,y,linestyle="--",color="crimson",marker="s",markersize=10,
linewidth=3)
pyplot.show()
pyplot.figure()
pyplot.plot(x,y,linestyle="--",color="blue",marker="s",markersize=10,
linewidth=3, markerfacecolor="red",markeredgecolor="yellow")
pyplot.show()

pyplot.figure()
pyplot.plot(x,y, "-sg")
pyplot.show()

pyplot.figure()
pyplot.plot(x,y, "--sg")
pyplot.show()

pyplot.figure()
pyplot.plot(x,y, "--sr")
pyplot.show()
pyplot.figure()
pyplot.plot(x,y, "--sr",label="x^2")
pyplot.plot(x,y2, "--or",label="x^2.1")
pyplot.plot(x,y3, "--vb",label="sqrt(x)")
pyplot.legend()
pyplot.show()

pyplot.figure()
pyplot.plot(x,y, "--sr",label=r"$x^2$")
pyplot.plot(x,y2, "--or",label=r"$x^{2.1}$")
pyplot.plot(x,y3, "--vb",label=r"$\sqrt{x}$")
pyplot.legend()
pyplot.show()

pyplot.figure()
pyplot.plot(x,y, "--sr",label=r"$x^2$")
pyplot.plot(x,y2, "--or",label=r"$x^{2.1}$")
pyplot.plot(x,y3, "--vb",label=r"$\sqrt{x}$")
pyplot.legend(fontsize=20)
pyplot.grid()
pyplot.xlim(-0,5,9.9) #desde donde
pyplot.ylim(-0.5,100)#hasta donde
pyplot.show()
pyplot.figure()
pyplot.plot(x,y, "--sr",label=r"$x^2$")
pyplot.plot(x,y2, "--or",label=r"$x^{2.1}$")
pyplot.plot(x,y3, "--vb",label=r"$\sqrt{x}$")
pyplot.legend(fontsize=20)
pyplot.grid()
pyplot.xlim(-0,5,9.9) #desde donde
pyplot.ylim(-0.5,100)#hasta donde
pyplot.title("Gráfica muy bonita",fontsize=20)
pyplot.show()

pyplot.figure()
pyplot.plot(x,y, "--sr",label=r"$x^2$")
pyplot.plot(x,y2, "--or",label=r"$x^{2.1}$")
pyplot.plot(x,y3, "--vb",label=r"$\sqrt{x}$")
pyplot.legend(fontsize=20)
pyplot.grid()
pyplot.xlim(-0,5,9.9) #desde donde
pyplot.ylim(-0.5,100)#hasta donde
pyplot.title("Gráfica muy bonita",fontsize=20)
pyplot.xlabel("$x$",fontsize=20)
pyplot.ylabel("$y$",fontsize=20)
pyplot.show()
pyplot.figure()
pyplot.plot(x,y, "--sr",label=r"$x^2$")
pyplot.plot(x,y2, "--or",label=r"$x^{2.1}$")
pyplot.plot(x,y3, "--vb",label=r"$\sqrt{x}$")
pyplot.legend(fontsize=20)
pyplot.grid()
pyplot.xlim(-0,5,9.9) #desde donde
pyplot.ylim(-0.5,100)#hasta donde
pyplot.title("Gráfica muy bonita",fontsize=20)
pyplot.xlabel("$x$",fontsize=20)
pyplot.ylabel("$y$",fontsize=20)
pyplot.yscale("linear")
pyplot.show()

from matplotlib import pyplot


import numpy
%matplotlib inline

%%time
b = numpy.random.normal(0.0,0.5,size=1000)
AA2= numpy.random.normal(0.1,1.0, size=10000)

pyplot.figure()
pyplot.hist(b,bins=50,density=True,lw=1,edgecolor="blue")
pyplot.hist(AA2,bins=50,density=True,lw=1,edgecolor="red")
pyplot.show()
AA = numpy.random.normal(0.0,0.5,size=10000)
AA2= numpy.random.normal(0.1,0.4,size=10000)
AA3= numpy.random.normal(-2,0.4,size=10000)
total= numpy.concatenate((AA,AA2,AA3))

pyplot.figure()
pyplot.hist(total,bins=50,density=True,lw=1,edgecolor="blue")
pyplot.show()

pyplot.figure()
pyplot.hist(total,bins=50,normed=True)
pyplot.show()

from matplotlib import pyplot


import numpy
%matplotlib inline

x=numpy.random.normal(0,1,size=1000)
y=numpy.random.uniform(0,1,size=1000)

pyplot.figure()
pyplot.scatter(x,y,s=1)
pyplot.show()
x=numpy.random.normal(0,1,size=10000)
y=numpy.random.uniform(0,10,size=10000)
y2=numpy.random.normal(0.8,0.1,size=10000)

pyplot.figure()
pyplot.scatter(x,y,s=1,color="red")
pyplot.scatter(x,y2,s=1,color="green")
pyplot.show()

También podría gustarte