Open main menu

Difference between revisions of "Xmgrace"

 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
[http://plasma-gate.weizmann.ac.il/Grace/ Grace], also known as Xmgrace, ACE/gr, and Xvgr, is a free [https://en.wikipedia.org/wiki/WYSIWYG WYSIWYG] 2D graph plotting tool used by relax '''grace''' user functions to provide the highest quality 2D graphing capabilities.
 +
 
== xmgrace ==
 
== xmgrace ==
 +
 +
[https://en.wikipedia.org/wiki/Grace_%28plotting_tool%29 Wikipedia description]
 +
 
[http://ae-www.technion.ac.il/cgi-bin/man.cgi?section=all&topic=grace xmgrace program options]
 
[http://ae-www.technion.ac.il/cgi-bin/man.cgi?section=all&topic=grace xmgrace program options]
  
== Convert to png ==
+
[http://ringo.ams.sunysb.edu/index.php/Xmgrace Recommended page]
 +
 
 +
[http://plasma-gate.weizmann.ac.il/Grace/doc/UsersGuide.html#ss4.2 Keyboard shortcuts]
 +
 
 +
== xmgrace font options ==
 +
[http://plasma-gate.weizmann.ac.il/Grace/doc/UsersGuide.html#typesetting Meaning of type-setting codes]
 +
 
 +
[http://www.alanwood.net/demos/symbol.html Homepage with symbol font conversion from Keyboard letter to greek symbol.]
 +
 
 +
<source lang="text">
 +
make font oblique: \q Test \Q
 +
greek: use \x w \B
 +
super: use \S letters \N
 +
sub:  use \s letters \N
 +
new line: \n
 +
 
 +
\0 normal
 +
\1 Bold
 +
\2 Italics
 +
\4 Roman
 +
\8 Greek Font
 +
 
 +
Examples:
 +
F\sX\N(\xe\f{}) = sin(\xe\f{})\#{b7}e\S-X\N\#{b7}cos(\xe\f{})
 +
 
 +
Partial derivative of energy with respect to lambda: \x\c6\CE/\c6\C\xl
 +
Infinity symbol: \x\c%
 +
Angstrom: \cE\C
 +
 
 +
\qCPMG pulse train frequency \Q (Hz)
 +
\qSpin-lock field strength \xn\B\s1\N\Q (Hz)
 +
\qEffective field in rotating frame \xw\B\seff\N\Q (rad.s\S-1\N)
 +
\qRotating frame tilt angle \xq\B\Q (rad)
 +
\qR\s2,eff\N\Q (rad.s\S-1\N
 +
\qR\s1\xr\B\N\Q (rad.s\S-1\N)
 +
\qR\\s2\N\Q (rad.s\S-1\N)
 +
h\v{0.65}\h{-0.5}\z{0.6}_\v{}\h{}\z{}
 +
\1x\h{-0.2}\v{0.7}.\v{}\h{}
 +
\1x\h{-0.2}\v{0.7}.\v{}\h{}
 +
 
 +
</source>
 +
 
 +
=== Manually Convert to png/eps for one xmgrace file===
 
Add this to the end of the xmgrace file
 
Add this to the end of the xmgrace file
  
 +
For PNG
 
<pre>
 
<pre>
 
#Print out to
 
#Print out to
Line 13: Line 61:
 
#@DEVICE "PNG" OP "transparent:on"
 
#@DEVICE "PNG" OP "transparent:on"
 
@DEVICE "PNG" OP "compression:9"
 
@DEVICE "PNG" OP "compression:9"
 +
@PRINT
 +
</pre>
 +
 +
For EPS
 +
<pre>
 +
#Print out to
 +
@PRINT TO "/sbinlab2/tlinnet/output.eps"
 +
@HARDCOPY DEVICE "EPS"
 +
@DEVICE "EPS" OP "level2"
 
@PRINT
 
@PRINT
 
</pre>
 
</pre>
Line 18: Line 75:
 
Then issue an "HARDCOPY" with xmgrace
 
Then issue an "HARDCOPY" with xmgrace
 
  xmgrace -hardcopy xmgracefile.agr
 
  xmgrace -hardcopy xmgracefile.agr
 +
 +
== In bash ==
 +
bash ;
 +
for agr in `ls *.agr`;do bn=`basename ${agr} .agr`;gracebat ${agr} -hdevice PNG -printfile ${bn}.png;done
  
 
== Script to make both png and eps for a folder with xmgrace files ==
 
== Script to make both png and eps for a folder with xmgrace files ==
Line 55: Line 116:
 
</source>
 
</source>
  
== Batch eps conversion ==
+
== Batch eps to PNG/PDF conversion ==
 
<pre>
 
<pre>
 
bash ;
 
bash ;
Line 62: Line 123:
  
 
== See also ==
 
== See also ==
[[Category:External_programs]]
+
 
 +
[[Category:Grace]]
 +
[[Category:Data visualisation software]]

Latest revision as of 16:26, 21 October 2020

Grace, also known as Xmgrace, ACE/gr, and Xvgr, is a free WYSIWYG 2D graph plotting tool used by relax grace user functions to provide the highest quality 2D graphing capabilities.

xmgrace

xmgrace font options

Meaning of type-setting codes

Homepage with symbol font conversion from Keyboard letter to greek symbol.

make font oblique: \q Test \Q
greek: use \x w \B
super: use \S letters \N
sub:   use \s letters \N
new line: \n

\0 normal
\1 Bold
\2 Italics
\4 Roman
\8 Greek Font

Examples:
 F\sX\N(\xe\f{}) = sin(\xe\f{})\#{b7}e\S-X\N\#{b7}cos(\xe\f{})

Partial derivative of energy with respect to lambda: \x\c6\CE/\c6\C\xl
Infinity symbol: \x\c%
Angstrom: \cE\C

\qCPMG pulse train frequency \Q (Hz)
\qSpin-lock field strength \xn\B\s1\N\Q (Hz)
\qEffective field in rotating frame \xw\B\seff\N\Q (rad.s\S-1\N)
\qRotating frame tilt angle \xq\B\Q (rad)
\qR\s2,eff\N\Q (rad.s\S-1\N
\qR\s1\xr\B\N\Q (rad.s\S-1\N)
\qR\\s2\N\Q (rad.s\S-1\N)
h\v{0.65}\h{-0.5}\z{0.6}_\v{}\h{}\z{}
\1x\h{-0.2}\v{0.7}.\v{}\h{}
\1x\h{-0.2}\v{0.7}.\v{}\h{}

Manually Convert to png/eps for one xmgrace file

Add this to the end of the xmgrace file

For PNG

#Print out to
@PRINT TO "/sbinlab2/tlinnet/output.png"
@HARDCOPY DEVICE "PNG"
@DEVICE "PNG" FONT ANTIALIASING on
# Make white background transparent
#@DEVICE "PNG" OP "transparent:on"
@DEVICE "PNG" OP "compression:9"
@PRINT

For EPS

#Print out to
@PRINT TO "/sbinlab2/tlinnet/output.eps"
@HARDCOPY DEVICE "EPS"
@DEVICE "EPS" OP "level2"
@PRINT

Then issue an "HARDCOPY" with xmgrace

xmgrace -hardcopy xmgracefile.agr

In bash

bash ;
for agr in `ls *.agr`;do bn=`basename ${agr} .agr`;gracebat ${agr} -hdevice PNG -printfile ${bn}.png;done

Script to make both png and eps for a folder with xmgrace files

#!/bin/bash

for gracefile in *.agr; do
filename=$(basename "$gracefile")
extension="${filename##*.}"
filename="${filename%.*}"

TMPPNG=${filename}_png.tmp
cat $gracefile > $TMPPNG
echo "#Print out to" >> $TMPPNG
echo '@PRINT TO "'"${PWD}/${filename}.png"'"' >> $TMPPNG
echo '@HARDCOPY DEVICE "PNG"' >> $TMPPNG
echo '@DEVICE "PNG" FONT ANTIALIASING on' >> $TMPPNG
echo '# Make white background transparent' >> $TMPPNG
echo '#@DEVICE "PNG" OP "transparent:on"' >> $TMPPNG
echo '@DEVICE "PNG" OP "compression:9"' >> $TMPPNG
echo '@PRINT' >> $TMPPNG
xmgrace -hardcopy $TMPPNG

TMPEPS=${filename}_eps.tmp
cat $gracefile > $TMPEPS
echo "#Print out to" >> $TMPEPS
echo '@PRINT TO "'"${PWD}/${filename}.eps"'"' >> $TMPEPS
echo '@HARDCOPY DEVICE "EPS"' >> $TMPEPS
echo '@DEVICE "EPS" OP "level2"' >> $TMPEPS
echo '@PRINT' >> $TMPEPS
xmgrace -hardcopy $TMPEPS

echo "$filename $extension"
#eps2png -resolution 200 $TMPEPS
#epstopdf $TMPEPS
done

Batch eps to PNG/PDF conversion

bash ;
for epsfile in *.eps; do eps2png -resolution 200 $epsfile; epstopdf $epsfile; echo "Making pdf/png: $epsfile"; done

See also