You are here: Home / Services / Data Analysis and Visualization / Visualization / Software / NCL / PyNGL / DKRZ PyNGL example simple xy-plot

DKRZ PyNGL example simple xy-plot

This PyNGL example shows how to create a simple xy-plot.

Example:

import numpy
import Ngl

#--  define x and y variables
x = [10., 20., 30., 40., 50., 60., 70., 80., 90.]
y = numpy.array([0., 0.7, 1., 0.7, 0., -0.7, -1., -0.7, 0.],'f')
                 
#-- open a workstation
wkres           =  Ngl.Resources()
wks             =  Ngl.open_wks("png","plot_xy_0_py",wkres)

#-- set resources
res             =  Ngl.Resources() #-- generate an res object for plot

#-- draw the plot
plot = Ngl.xy(wks,x,y,res)

#-- done
Ngl.end()

Result:

DKRZ PyNGL example simple xy-plot w200

 

Document Actions