@sines-3.py

from __future__ import print_function
from os import path
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocatorFormatStrFormatter

ImgsPath = r'C:\CJS\prj\Python\ws\charts\imgs'
fn = 'sines-3.png'

Radians = lambda d: 2.0 * np.pi * (d/360.0)

xmin,xmax = (-4.0 * np.pi), (+4.0 * np.pi)
ymax,ymin = +2.00, -2.00

xt = np.arange(xminxmax0.01)

dx1 = [np.sin(x*1)/1.0 for x in xt]
dx2 = [np.sin(x*2)/2.0 for x in xt]
dx3 = [np.sin(x*3)/3.0 for x in xt]
dx4 = [np.sin(x*4)/4.0 for x in xt]
dx5 = [np.sin(x*5)/5.0 for x in xt]
dx6 = [np.sin(x*6)/6.0 for x in xt]
dx7 = [np.sin(x*7)/7.0 for x in xt]
dx8 = [np.sin(x*8)/8.0 for x in xt]
dx9 = [np.sin(x*9)/9.0 for x in xt]

dx0 = [sum(tfor t in zip(dx1,dx2,dx3,dx4,dx5,dx6,dx7,dx8,dx9)]

figax = plt.subplots()
fig.suptitle('Sine Waves')
ax.set_xlabel('X Axis')
ax.set_ylabel('Y Axis')
ax.set_xlim(xminxmax)
ax.set_ylim(yminymax)
ax.minorticks_on()
ax.xaxis.set_major_locator(MultipleLocator(np.pi * 2))
ax.yaxis.set_major_locator(MultipleLocator(0.25))
ax.xaxis.set_major_formatter(FormatStrFormatter('%.2f'))
ax.yaxis.set_major_formatter(FormatStrFormatter('%+.2f'))
ax.xaxis.set_minor_locator(MultipleLocator(np.pi/4))
ax.yaxis.set_minor_locator(MultipleLocator(0.05))
ax.tick_params(which='major'axis='both'direction='out'zorder=0)
ax.tick_params(which='minor'axis='both'direction='out'zorder=0)
ax.grid(which='minor'axis='both'color='#efefff'lw=0.6,ls='-',zorder=0alpha=1.0)
ax.grid(which='major'axis='both'color='#7f7fbf'lw=1.2,ls='-',zorder=1alpha=1.0)

ax.plot(xt,dx1color='#000000'lw=0.80zorder=3alpha=0.85)
ax.plot(xt,dx2color='#1f1f1f'lw=0.80zorder=3alpha=0.85)
ax.plot(xt,dx3color='#3f3f3f'lw=0.80zorder=3alpha=0.85)
ax.plot(xt,dx4color='#5f5f5f'lw=0.80zorder=3alpha=0.85)
ax.plot(xt,dx5color='#7f7f7f'lw=0.80zorder=3alpha=0.85)
ax.plot(xt,dx6color='#9f9f9f'lw=0.80zorder=3alpha=0.85)
ax.plot(xt,dx7color='#afafaf'lw=0.80zorder=3alpha=0.85)
ax.plot(xt,dx8color='#cfcfcf'lw=0.80zorder=3alpha=0.85)
ax.plot(xt,dx9color='#dfdfdf'lw=0.80zorder=3alpha=0.85)
ax.plot(xt,dx0color='#ff0000'lw=1.60zorder=9alpha=0.85)

fig.set_figwidth(8.0)
fig.set_figheight(4.8)
fig.subplots_adjust(left=0.10bottom=0.10right=0.90top=0.90)

fig.savefig(path.join(ImgsPath,fn))
#plt.show()