#! /usr/bin/env python # -*- coding: utf-8 -*- """ A first demo of the MatPlotLib plotting module for Python, to plot the sin function. @date: Sun Apr 12 20:29:05 2015. @author: Lilian Besson for CS101 course at Mahindra Ecole Centrale 2015. @licence: MIT Licence (http://lbesson.mit-license.org). """ # Usual way to import MatPlotLib and NumPy: import matplotlib.pyplot as plt import numpy as np # 500 points from -4*pi to 4*pi X = np.linspace(-4*np.pi, 4*np.pi, 500) # computes the values one by one Y = np.sin(X) plt.plot(X, Y) # plt.show() plt.savefig("firstexample.png", dpi=140)