This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/resources/python/tutorial/04plotting.py

21 lines
461 B
Python

from numpy import *
from matplotlib.pyplot import *
# google matplotlib gallery
# create basepoints and function values
x = linspace(-2., 2., 100)
y = (x + 2.)**2 - 5.
fig = figure() # create figure
ax = fig.add_subplot(1,1,1) # subplot with 1 row, 1 column, and get axes of first plot
ax.plot(x,y)
ax.set_xlabel('x values')
ax.set_ylabel('y values')
ax.set_title('quadratic function')
show() # show plot
fig.savefig( "test.pdf" ) # saves plot into file