10.5.3 The construction of large multiplots
By default, whenever an item is added to a multiplot, or an existing item moved or replotted, the whole multiplot is replotted to show the change. This can be a time consuming process on large and complex multiplots. For this reason, the set nodisplay command is provided, which stops Pyxplot from producing any output. The set display command can subsequently be issued to return to normal behaviour. This can be especially useful in scripts which produce large multiplots. There is no point in producing output at each step in the construction of a large multiplot, and a great speed increase can be achieved by wrapping the script with:
set nodisplay
[...prepare large multiplot...]
set display
refresh
Example: A diagram from Euclid’s Elements In this more extended example script, we use Pyxplot’s arrow and text commands to reproduce a diagram illustrating the 47th Proposition from Euclid’s First Book of Elements, better known as Pythagoras’ Theorem. A full text of the proof which accompanies this diagram can be found at http://www.gutenberg.org/etext/21076.
Example: A diagram of the conductivity of nanotubes In this example we produce a diagram of the irreducible wedge of possible carbon nanotube configurations, highlighting those configurations which are electrically conductive. We use Pyxplot’s loop constructs to automate the production of the hexagonal grid which forms the basis of the diagram. basisAngleX = 0*unit(deg)basisAngleY = 120*unit(deg)lineLen = 5*unit(mm)# Set up a transformation matrixtransformMat = matrix([[sin(basisAngleX),sin(basisAngleY)], [cos(basisAngleX),cos(basisAngleY)] ])transformMat *= lineLensubroutine line(p1,p2,lw) { line from transformMat*p1 to transformMat*p2 with linewid lw }subroutine hexagon(p,lw) { call line(p+vector([ 0, 0]),p+vector([ 0,-1]),lw) call line(p+vector([ 0,-1]),p+vector([ 1,-1]),lw) call line(p+vector([ 1,-1]),p+vector([ 2, 0]),lw) call line(p+vector([ 2, 0]),p+vector([ 2, 1]),lw) call line(p+vector([ 2, 1]),p+vector([ 1, 1]),lw) call line(p+vector([ 1, 1]),p+vector([ 0, 0]),lw) }set multiplot ; set nodisplayfor x=0 to 10 { for y=0 to x+1 { p = vector([x+2*y , 2*x+y]) call hexagon(p, ((x-y)%3==0)?4:1) text ’%d,%d’%(x,y) at transformMat*(p+vector([1,0])) hal cen val cen } }set display ; refresh
|
|