Editing
Graphics with GLE
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
The [http://glx.sourceforge.net Graphics Layout Engine] is a multi-platform open-source package that can create a whole variety of plots from user-defined scripts. It has both very basic drawing primitives and more advanced canvases. It is similar to the vplot core library, with the difference is that plotting templates are saved in script files instead of C programs. Here is an example of a SConstruct drawing a simple 2D analytic function in isometric view: <python> from rsf.proj import * o1=-2 o2=-2 n1=41 n2=41 d1=0.1 d2=0.1 Flow('cosxpy',None, ''' math o1=%g o2=%g n1=%d n2=%d d1=%g d2=%g output="cos(x1*x1+x2*x2)*exp(-0.1*(x1*x1+x2*x2))" ''' % (o1,o2,n1,n2,d1,d2)) Result('cosxpy','grey color=j') # Prepare data for GLE Flow('cosxpy.z','cosxpy', ''' disfil number=n col=%d header="! nx %d ny %d xmin %g xmax %g ymin %g ymax %g" ''' % (n2,n1,n2,o1,o1+(n1-1)*d1,o2,o2+(n2-1)*d2)) # Call GLE Result('cosxpy_iso','cosxpy.gle cosxpy.z', ''' gle -device pdf -output ${TARGETS[0]} ${SOURCES[0]} ''',suffix='.pdf',stdin=0,stdout=0) End() </python> The trick is wrapped into the two last <tt>Result()</tt> and <tt>Flow()</tt> statements. The Flow generates a special ASCII file with function values, which will be later used by GLE. The Result actually calls GLE and makes it write a PDF file. The drawing script is contained in another file -- <tt>cosxpy.gle</tt> , which has a rather simple format: <pre> size 10 10 set font texcmr hei 0.5 just tc begin surface size 10 10 data "cosxpy.z" title "Hat function (3D)" xtitle "X-axis" hei 0.4 dist 0.7 ytitle "Y-axis" hei 0.4 dist 0.7 ztitle "Z-axis" hei 0.4 dist 0.9 top color red underneath color blue base xstep 1 ystep 1 zaxis min -1.5 max 1.5 hei 0.35 xaxis hei 0.35 dticks 1 yaxis hei 0.35 dticks 1 xlines on ylines on rotate 45 60 0 end surface </pre> <b>scons lock</b> works just fine and the resulted image is ready to be used in a paper with the regular macros like <tt>\plot</tt> or <tt>\multiplot</tt> . The only problem that appears is when <b>scons view</b> is run. It tries to run <tt>sfpen</tt> to view the resulted PDF file and fails, of course. But other than that, the result (figure below) shows a nice isometric plot, which can be easily reproduced in a regular Madagascar fashion. [[Image:GLE_example.png]]
Summary:
Please note that all contributions to Madagascar are considered to be released under the GNU Free Documentation License 1.3 or later (see
My wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
English
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Getting Madagascar
download
Installation
GitHub repository
SEGTeX
Introduction
Package overview
Tutorial
Hands-on tour
Reproducible documents
Hall of Fame
User Documentation
List of programs
Common programs
Popular programs
The RSF file format
Reproducibility with SCons
Developer documentation
Adding programs
Contributing programs
API demo: clipping data
API demo: explicit finite differences
Community
Conferences
User mailing list
Developer mailing list
GitHub organization
LinkedIn group
Development blog
Twitter
Slack
Tools
What links here
Related changes
Special pages
Page information