matplotlib
play

Matplotlib Matplotlib import matplotlib.pyplot as p - PowerPoint PPT Presentation

Matplotlib Matplotlib import matplotlib.pyplot as p import numpy as np def f(t): return t**2*np.exp(-t**2) t=np.linspace(0,3,51) y=f(t) p.plot(t,y,r-') p.show() Matplotlib


  1. Matplotlib Γραφικές παραστάσεις

  2. Matplotlib import matplotlib.pyplot as p import numpy as np def f(t): return t**2*np.exp(-t**2) t=np.linspace(0,3,51) y=f(t) p.plot(t,y,’r-') p.show()

  3. Matplotlib Προσθέτουμε στοιχεία : Στους άξονες , λεζάντα import matplotlib.pyplot as p import numpy as np def f(t): return t**2*np.exp(-t**2) t=np.linspace(0,3,51) y=f(t) p.plot(t,y,’r-‘) p.xlabel('t') p.ylabel('y') p.legend(['t^2*exp(-t^2)']) p.show()

  4. Matplotlib Προσθέτουμε στοιχεία : Δύο γραφικές παραστάσεις import matplotlib.pyplot as p import numpy as np def f(t): return t**2*np.exp(-t**2) def f2(t): return t**4*np.exp(-t**2)

  5. Matplotlib Προσθέτουμε στοιχεία : Δύο γραφικές παραστάσεις p.subplot(2,1,1) p.plot(t,y,'r-') p.xlabel('t') p.ylabel('y') p.legend(['t^2*exp(-t^2)']) y2=f2(t) p.subplot(2,1,2) p.plot(t,y2,'bs') p.xlabel('t') p.ylabel(‘y') p.legend(['t^4*exp(-t^2)']) p.show()

  6. Matplotlib Αλλάζουμε τη διάταξη των γραφικών παραστάσεων p.subplot(1,2,1) p.plot(t,y,'r-') p.xlabel('t') p.ylabel('y') p.legend(['t^2*exp(-t^2)']) y2=f2(t) p.subplot(1,2,2) p.plot(t,y2,'bs') p.xlabel('t') p.ylabel(‘y') p.legend(['t^4*exp(-t^2)']) p.show()

  7. “Type a quote here.” –Johnny Appleseed

  8. Γραφήματα 3- διαστάσεις Βιβλιοθήκες που “ φορτώνουμε ”: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.axes3d import Axes3D

  9. Γραφήματα 3- διαστάσεις Δημιουργούμε τα σημεία του επιπέδου xy που θα βρίσκετε το γράφημα : import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.axes3d import Axes3D x=np.linspace(-5,5,100) y=x.copy() X,Y=np.meshgrid(x,y)

  10. Γραφήματα 3- διαστάσεις Δημιουργούμε το αντικείμενο που θα “ ζωγραφήσουμε ” το γράφημα : import matplolib.pyplot as plt from mpl_toolkits.mplot3d.axes3d import Axes3D fig=plt.figure() axes=fig.add_axes([0.1,0.1,0.8,0.8],projection='3d')

  11. Γραφήματα 3- διαστάσεις Δημιουργούμε το γράφημα : import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.axes3d import Axes3D fig=plt.figure() axes=fig.add_axes([0.1,0.1,0.8,0.8],projection='3d') Z=X**2-Y**2 axes.plot_surface(X,Y,Z,rstride=5,cstride=5,linewidth=1) plt.show()

  12. “Type a quote here.” –Johnny Appleseed

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend