2012 Aug 1: Pyxplot 0.9.0
Version 0.9 is a major update. Many new data types have been introduced, each of which has methods which can be called in an object-orientated fashion. These include:
Colors, which can be stored in variables for subsequent use in vector graphics commands. The addition and subtraction operators act on colors to allow color mixing.
Dates, which can be imported from calendar dates, unix times or Julian dates. Dates can be subtracted to give time intervals.
Lists and dictionaries, which can be iterated over, or used to feed calculated data into the plot and tabulate commands.
Vectors and matrices, which allow matrix algebra. These types interface cleanly with Pyxplot’s vector-graphics commands, allowing positions to be specified as vector expressions.
File handles, which allow Pyxplot to read data from files, or write data or logs to files.
Modules and classes, which allow object-orientated programming.
In addition, Pyxplot’s range of operators has been extended to include most of those in the C programming language, allowing expressions such as
pyxplot> print (a=3)+(b=2)
pyxplot> print a0?"yes":"no"
pyxplot> print "%s %s"%(++a,b++)
pyxplot> print (a+=10 , b+=10 , a+b)
to be written.
Incompatibilities with Pyxplot 0.8
The extensions to Pyxplot in version 0.9 mean that some minor changes to syntax have been necessary. These include:
Some functions and variables have been renamed. Variables whose names used to begin phy_ now live in a module called phy. They may be accessed as, for example, phy.c. Similarly, random number generating functions now live in a module called random; statistics functions in a module called stats; time-handling functions in time; operating system functions in os; and astronomy functions in ast. The contents of these modules can be listed by typing, for example, print phy.
Custom colors, which used to be specified using syntax such as rgb0.2:0.3:0.4, should now be specified using the rgb(r,g,b) functions, as, for example, rgb(0.2,0.3,0.4). Custom colors can now be stored in variables for later use (see Section 6.6).
The range of escape characters which can be used in strings has been increased, so that, for example, n is a newline and t a tab. As in python, prepending the string with the character r disables all escape character expansion. As backslashes are common characters in latex command strings, the easiest approach is to always prepend latex strings with an r. As in python, triple quotes, e.g. r"""2 times 3""" can be used where required (see Section 3.6).
In the foreach command, square brackets should be used to delimit lists of items to iterate over. The Pyxplot 0.8 syntax foreach i in (1,2,3) should now be written foreach i in [1,2,3] (see Section 7.3).