Tutorial:Plot Example

From ALPS
Jump to: navigation, search

Example 1 on makeGracePlot module:

As an example we use a 2-column text file of the binned density of states, is stored in density-of-states.txt. The following is the step-by-step illustration of how we can generate a grace script.

import numpy as np
import pyalps
from pyalps.plot import makeGracePlot
data = np.loadtxt("density-of-states.txt").transpose()
data    = DataSet()
dataset.x = data[0]
dataset.y = data[1]
dataset.props = {label' :  "Enter my label here"}
title = "Density of States"
xaxis = {'label' :  "E"}
yaxis = {'label' : "D(E)"}
legend = {};
outfile = open("density-of-states.xmgr", 'w')
outfile.write(makeGracePlot([dataset], title, xaxis, yaxis, legend))
outfile.close()