Difference between revisions of "Tips for Xmgrace"

From LPTMS Wiki
Jump to: navigation, search
m (Typography)
m (Changing colors in Xmgrace)
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
== General Information ==
 +
 +
* [http://plasma-gate.weizmann.ac.il/Grace/doc/UsersGuide.html User Guide]
 +
* [http://plasma-gate.weizmann.ac.il/Grace/phpbb/ Xmgrace Forum]
 +
 
== Editing ==
 
== Editing ==
  
Line 4: Line 9:
 
* copy-paste within different boxes does not seem to be possible, one can open a terminal for temporary paste.
 
* copy-paste within different boxes does not seem to be possible, one can open a terminal for temporary paste.
  
==Typography==
+
== Customizing Xmgrace ==
 +
 
 +
==== General parametrization of the software ====
 +
 
 +
create the file ~/.grace/gracerc.user and enter your [http://plasma-gate.weizmann.ac.il/Grace/doc/UsersGuide.html#ss5.6 device parameters].
 +
 
 +
<u>Example :</u> setting default printing to the ''.eps'' format : add the following line
 +
HARDCOPY DEVICE "EPS"
 +
 
 +
==== Creating a default template graph used when opening xmgrace ====
 +
 
 +
A simple way to customize Xmgrace is to use a default template ''.agr'' file that you can save in the directory (create it if it does not exist)
 +
 
 +
~/.grace/templates/Default.agr
 +
 
 +
==== Changing colors in Xmgrace ====
 +
 
 +
The color maps in a ".agr" file are defined at the beginning using the following syntaxe
 +
@map color ''number'' to (''R,G,B''), "''colorname''"
 +
where R,G,B and the usual integers from 0 to 255 of the RGB code.
 +
 
 +
It is highly recommended not to change the first two colors (black&white) as they are used as default parameters in many places. Keep
 +
@map color 0 to (255, 255, 255), "white"
 +
@map color 1 to (0, 0, 0), "black"
 +
 
 +
For others, you can add/change colors and colornames. The color number matters when you use ''set different colors'' for instance.
 +
 
 +
In order to automatically generate some gradients, you can find on the page [[generating color palette for Xmgrace]] little script that produce the sequences for a given number of curves. Here are some of the results:
 +
 
 +
[[File:std.png|200px|]] [[File:grayscale.png|200px|]] [[File:gradient.png|200px|]] [[File:lighter.png|200px|]]
 +
 
 +
== Manipulating data ==
 +
 
 +
* [http://plasma-gate.weizmann.ac.il/Grace/doc/UsersGuide.html#ss5.4 functions available]
 +
* you can directly access data of set s''n'' via s''n''.y and s''n''.x
 +
 
 +
== Useful inline commands and aliases ==
 +
 
 +
* grabbing data from pipe
 +
:> ./program_printing_data | xmgrace -pipe
 +
 
 +
* Some bash aliases (or command lines) for defining axis and data type
 +
alias xmlog='xmgrace -log xy'
 +
alias xmlogy='xmgrace -log y'
 +
alias xmlogx='xmgrace -log x'
 +
alias xmbar='xmgrace -settype xydy'
 +
alias xmlogbar='xmgrace -log xy -settype xydy'
 +
alias xmlogybar='xmgrace -log y -settype xydy'
 +
 
 +
== Typography ==
 +
 
 +
* when typing in a text , you can invoke the ''Font-Tool'' application by pressing
 +
Ctrl-e
 +
and then choose your token and press ''Apply''. It will insert the chosen token in your current text line.
  
* More general shortcuts for \f{Police} (''have to check this'')
+
* Shortcuts for \f{Police} (''have to check this'')
 
  \0  Times-Roman
 
  \0  Times-Roman
  \1  bold
+
  \1  Times-Italic
  \2  italic
+
  \2  Time-Bold
  \3  bold-italic
+
  \3  Time-BoldItalic
 
  \4  Helvetica
 
  \4  Helvetica
  \5  Helvetica - bold
+
  \5  Helvetica-Oblique
  \6  Helvetica - italic
+
  \6  Helvetica-Bold
  \7  Helvetica - bold-italic
+
  \7  Helvetica-BoldOblique
  \8  greek
+
  \f{} get back to original font
  \9 symbol (or \x )
+
  \x Symbol (in particular Greek letters)
* Shortcuts for text manipulation
+
* Shortcuts for text manipulation (From [http://plasma-gate.weizmann.ac.il/Grace/doc/UsersGuide.html#ss7.1 Grace guide])
 
  \+  increase size
 
  \+  increase size
 
  \-  decrease size
 
  \-  decrease size
 
  \b  backspace (size of previous character)
 
  \b  backspace (size of previous character)
\c  begin using upper 128 characters of set
 
\C  stop  using upper 128 characters of set
 
 
  \u  begin underline
 
  \u  begin underline
 
  \U  stop underline
 
  \U  stop underline
Line 29: Line 85:
 
  \N  normal
 
  \N  normal
 
  \n  newline
 
  \n  newline
  \f{} get back to original
+
  \o  begin overline
\u  underline text
+
\O end overline
\o  overline text
+
 
 +
 
 +
* Useful examples:
 +
 
 +
{| cellpadding="10"
 +
| <math>\hbar</math> || <pre>h\v{0.65}\h{-0.5}\z{0.6}_\v{}\h{}\z{}</pre>
 +
|-
 +
| <math>\dot{x}</math> || <pre>\1x\h{-0.2}\v{0.7}.\v{}\h{}</pre>
 +
|-
 +
| <math>\infty</math> || <pre>\x¥</pre>
 +
|}
  
Examples:
+
== Inserting Latex Formulas in eps ==
  
* writing <math>\hbar</math>
+
There are two main options : either use Inkscape which can generate Latex formula for graphics or use psfrag and Latex to produce another .eps file. For this second option, you can find further information [http://www.guillaume.roux.free.fr/Tips/tips_for_eps_files.htm here].
h\v{0.65}\h{-0.5}\z{0.6}_\v{}\h{}\z{}
 

Latest revision as of 13:39, 23 November 2011

General Information

Editing

  • Beware: there is no Undo option but Reverse to saved so it is better to often save your working document.
  • copy-paste within different boxes does not seem to be possible, one can open a terminal for temporary paste.

Customizing Xmgrace

General parametrization of the software

create the file ~/.grace/gracerc.user and enter your device parameters.

Example : setting default printing to the .eps format : add the following line

HARDCOPY DEVICE "EPS"

Creating a default template graph used when opening xmgrace

A simple way to customize Xmgrace is to use a default template .agr file that you can save in the directory (create it if it does not exist)

~/.grace/templates/Default.agr

Changing colors in Xmgrace

The color maps in a ".agr" file are defined at the beginning using the following syntaxe

@map color number to (R,G,B), "colorname"

where R,G,B and the usual integers from 0 to 255 of the RGB code.

It is highly recommended not to change the first two colors (black&white) as they are used as default parameters in many places. Keep

@map color 0 to (255, 255, 255), "white"
@map color 1 to (0, 0, 0), "black"

For others, you can add/change colors and colornames. The color number matters when you use set different colors for instance.

In order to automatically generate some gradients, you can find on the page generating color palette for Xmgrace little script that produce the sequences for a given number of curves. Here are some of the results:

Std.png Grayscale.png Gradient.png Lighter.png

Manipulating data

Useful inline commands and aliases

  • grabbing data from pipe
:> ./program_printing_data | xmgrace -pipe
  • Some bash aliases (or command lines) for defining axis and data type
alias xmlog='xmgrace -log xy'
alias xmlogy='xmgrace -log y'
alias xmlogx='xmgrace -log x'
alias xmbar='xmgrace -settype xydy'
alias xmlogbar='xmgrace -log xy -settype xydy'
alias xmlogybar='xmgrace -log y -settype xydy'

Typography

  • when typing in a text , you can invoke the Font-Tool application by pressing
Ctrl-e

and then choose your token and press Apply. It will insert the chosen token in your current text line.

  • Shortcuts for \f{Police} (have to check this)
\0  Times-Roman
\1  Times-Italic
\2  Time-Bold
\3  Time-BoldItalic
\4  Helvetica
\5  Helvetica-Oblique
\6  Helvetica-Bold
\7  Helvetica-BoldOblique
\f{} get back to original font
\x  Symbol (in particular Greek letters)
\+  increase size
\-  decrease size
\b  backspace (size of previous character)
\u  begin underline
\U  stop underline
\s  subscript
\S  superscript
\N  normal
\n  newline
\o  begin overline
\O end overline


  • Useful examples:
\hbar
h\v{0.65}\h{-0.5}\z{0.6}_\v{}\h{}\z{}
{\dot  {x}}
\1x\h{-0.2}\v{0.7}.\v{}\h{}
\infty
\x¥

Inserting Latex Formulas in eps

There are two main options : either use Inkscape which can generate Latex formula for graphics or use psfrag and Latex to produce another .eps file. For this second option, you can find further information here.