-
Notifications
You must be signed in to change notification settings - Fork 0
/
senocoseno_plot2.py
38 lines (26 loc) · 968 Bytes
/
senocoseno_plot2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Plot the sine cosine graph instantiating all settings
# Chart will be saved in png format
import pylab as pl
import numpy as np
# Creates a figure of size 8x6 points, 80 points per inch
pl.figure(figsize=(8, 6), dpi=80)
# Creates a new subplot from a 1x1 grid
pl.subplot(1, 1, 1)
X = np.linspace(-np.pi, np.pi, 256, endpoint=True)
C, S = np.cos(X), np.sin(X)
# Plot the cosine with a continuous blue line of thickness 1 (pixels)
pl.plot(X, C, color="blue", linewidth=1.0, linestyle="-")
# Plot the sine with a continuous green line of thickness 1 (pixels)
pl.plot(X, S, color="green", linewidth=1.0, linestyle="-")
# Sets the limits on x
pl.xlim(-4.0, 4.0)
# Sets the x marks
pl.xticks(np.linspace(-4, 4, 9, endpoint=True))
# Defines the limits in y
pl.ylim(-1.0, 1.0)
# Sets the y-marks
pl.yticks(np.linspace(-1, 1, 5, endpoint=True))
# Saves the figure using 72 dots per inch
pl.savefig("sencos.png", dpi=72)
# Shows the result on the screen
#pl.show()