Difference between revisions of "Xmgrace"

From relax wiki
Jump to navigation Jump to search
Line 2: Line 2:
 
[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 ===
+
== Convert to png ==
 
Add this to the end of the xmgrace file
 
Add this to the end of the xmgrace file
  
Line 18: Line 18:
 
Then issue an "HARDCOPY" with xmgrace
 
Then issue an "HARDCOPY" with xmgrace
 
  xmgrace -hardcopy xmgracefile.agr
 
  xmgrace -hardcopy xmgracefile.agr
 +
 +
== Script to make both png and eps for a folder with xmgrace files ==
 +
<source lang="bash">
 +
#!/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
 +
rm $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
 +
</source>
  
 
== Batch eps conversion ==
 
== Batch eps conversion ==

Revision as of 12:08, 13 June 2013

xmgrace

xmgrace program options

Convert to png

Add this to the end of the xmgrace file

#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

Then issue an "HARDCOPY" with xmgrace

xmgrace -hardcopy xmgracefile.agr

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
rm $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 conversion

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

See also