# EzPlot_Example Tutorial [download iPython Notebook](EzPlot_Example.ipynb) EzPlot_Example

EzPlot Example

In [1]:
import os
import vcs
import cdms2
import vcsaddons.EzPlot
import cdutil
import math
import random

# Simple Plot with EzPlot


variables  = []
line_type  = []
line_widths = []
legend_texts = []
legend_text_colors = []
marker_type = []

for v in range(0, 20):
    var = []
    for i in range(0, 100):
        if v%2 == 0:
            #var.append(random.random() * v * math.sin(2*math.pi*float(i-v)/100.0))
            var.append(v * math.sin(2*math.pi*float(i-v)/100.0))
        else:
            #var.append(random.random() * v * math.cos(2*math.pi*float(i-v)/100.0))
            var.append(v * math.cos(2*math.pi*float(i-v)/100.0))
    line_type += ["solid"]
    line_widths += [5]
    if i%2 == 0:
        legend_texts += ["Sin"]
    else:    
        legend_texts += ["Cos"]
    legend_text_colors += ['black']
    marker_type += [None]
    variables.append(var)

plotfunction = vcsaddons.EzPlot.EzLinePlot()

canvas = vcs.init()

d = plotfunction.lineplot(data=variables, canvas=canvas, title="Simple 2 EzLinePlot", titlesize=30,
                          #backgroundcolor=[0, 100, 0],
                          linetypes=line_type, linewidths=line_widths,
                          legendposition=[0.25, 0.35, 0.30, 0.40], legendtextcolors=legend_text_colors, 
                          legendtexts=legend_texts,
                          legendbackgroundcolor="yellow",
                          enablegrid=True)

canvas.png("EzPlot_Simple2")

d
Out[1]: