Plotting in ASCEND

From ASCEND

(Redirected from PlottingInAscend)
Jump to: navigation, search

You can generate x-y plots with ASCEND using both the main Tcl/Tk interface as well as the new PyGTK interface. See further down for details about the PyGTK interface.

Contents

[edit] Plotting via the Tcl/Tk ASCEND interface

Tcl/Tk ASCEND uses xgraph in Linux and unix to produce plots. On Windows we use the tkxgraph package authored by Ben Allan (http://ascend.cheme.cmu.edu/ftp/pdfMisc/tkxgraph.pdf).

See also the Tcl/Tk screenshots.

[edit] Linux (and presumably, unix)

One needs to have a working copy of xgraph installed for ASCEND to produce plots. In the ASCEND download/unix web page are links to various compressed files containing a version of xgraph that functions properly (http://ascend.cheme.cmu.edu/ascend_unix.htm, see item 10). Also, John Pye has produced an RPM (if you are using the right version of linux) to install a suitable "enhanced" version of xgraph11 (http://pye.dyndns.org/ascend/). His web site indicates the source for this version.

Do NOT install just any version of xgraph11. There are versions available that are "bare bones" versions and that have a data file format that differs from those mentioned above.

I proceeded as follows to install a working version.

  1. Downloaded and uncompressed xgraph from the ASCEND web pages.
  1. Added the following lines at the end of their respective obvious locations to the file "Makefile.gmake".
PLATFORM=linux

and

ifeq "$(PLATFORM)" "linux"
LIBS = -L/usr/X11R6/lib -lX11 -lm
endif

and commented out the currently defined PLATFORM=??? instruction.

  1. Made a new executable for xgraph by executing "make -f Makefile.gmake"
  1. Moved into a directory along my PATH (e.g., to /usr/bin) and created a symbolic link to point to this xgraph: "ln -s /pathToNewlyCreatedXgraph/xgraph"

Now I needed to test if this all worked. I started up ASCEND (my script for doing this is as follows:

#!/bin/sh
#
# Usage: ascend4
#
ASCENDDIST=/home/aw0a/ascend
export ASCENDDIST
ASCENDLIBRARY=/ProgramsUnregistered/ascend4-0.9.5/ascend4/models/
export ASCENDLIBRARY
ASCENDTK=/home/aw0a/ascend/tcltk98/TK
export ASCENDTK
$ASCENDDIST/bin/ascend4
  1. Loaded the script separation_demos.a4s (File/Read file). Then I executed the first two instructions
DELETE TYPES;
READ FILE "plotcol.a4c";

I then skipped down to the instructions defining DemoPlotMacro and the eight lines following that solve a column model and produce plots from it.

All this worked just fine for me. I got nice plots with suitable labeling.

If it still does not work, return to the Script window and select Tools/System utilities. A window will open that allows you to set links to various resources. Both the "Plot program name" amd the "Plot file type" should be "xgraph". If you have not put xgraph on your PATH, then set "Plot file name" to the path for xgraph, e.g.,

/mybin/xgraph

[edit] Windows

The load module for windows contains the file /ProgramsUnregistered/ascend4-0.9.5/Tcl/bin/tkxgraph.exe. Again, follow the instructions above to run the ASCEND script separation_demos.a4s to test if plotting is working. If not, return to the Script window and select Tools/System utilities. In the window set the "Plot program name" to something like the following

C:/ProgramsUnregistered/ascend4-0.9.5/Tcl/bin/tkxgraph.exe -- -f

Be sure to use forward slashes here. Be sure you put spaces where they belong also (before -- and before -f). I set the "Plot file type" to "tkxgraph".

[edit] PtPlot

It seems that the plotting tool PtPlot (http://ptolemy.eecs.berkeley.edu/java/ptplot/) offers an xgraph-compatible mode, which means that this program can be used as a drop-in replacement for xgraph and tkxgraph on both windows and linux. See the following link for more info:

http://ptolemy.eecs.berkeley.edu/java/ptolemy.plot2.0/ptolemy/plot/

[edit] Plotting via the PyGTK interface

Plotting functionality is also available via the PyGTK interface. You must ensure you have numpy and matplotlib installed (these are free open-source Python extensions that work on both Linux and Windows). Then, when you load a model of the riht type you can right-click on the appropriate element in the instance hierarchy and click the 'Plot' option. You will get a plot window like so:

Image:ascend-pygtk-plot.png

This works, as above, for plotting the special ASCEND 'Plot' instances.

Writing you model into the special ASCEND 'Plot' instance structure can be a bit of a pain. An alternative that is available in the PyGTK GUI is the Observer functionality (see PyGTK Screenshots) to capture a grid full of data then take it over to a spreadsheet and plot it there.

Personal tools