Xmgr annotations

| categories: xmgr | View Comments

Frankly, I think that xmgr is obsolete. It had some grace (pun intended) 10yrs ago, and it still produces very consistent graphs. But it smells like an old cheese, it lacks latex/regexps/modern scripting language/importing of modern binary formats/2D heat maps. Nevertheless, if I happen to have an ascii data file around, I am still tempted to launch it once in every while. GMT will take you further, but xmgr will take you faster (once you get the hang of its awkward arrangement of menus).

This guy summarizes for us some of the very basic subtleties of xmgr's gui. The most important for me are related to special chars:

The old way of including special chars/fonts :

What example
superscript x\S2\N
Subscript 3\s10\N
Greek letters (e.g. theta) \f{Symbol}q\f{}
Special symbols (e.g. Angstrom symbol) \cE\C

The new method to insert special characters in xmgrace is:

Press ctrl-e while positioned in a text-edit field to bring up the font dialog box, and select whatever you want.

Thanks Louic .

Copyright (C) 2015 by Avi Gozolchiani. See the License for information about copying.

org-mode source

Read and Post Comments

matlab subplots packed densely together

| categories: xmgr, matlab, octave, gmt | View Comments

During significant portion of my grad-school I had to travel a lot. I therefore couldn't rely on hooking to the university matlab license, so I searched for free alternatives. While you could use a lot of good projects, such as octave to crunch your numbers, it seems to me that making beautiful figures is not so easy.

I got used to plotting with the excellent packages of GMT . I even wrote some little octave wrapper functions around GMT, since it's easy to get intimidated by their too elaborate man pages. You could still try them out, though GMT has been working lately on an official matlab API for you (they do have mature API for c++/Fortran). I didn't try it myself, yet. Another option is good old xmgr . Both of them produce great imagery, but they have their limitations at times.

The one point where matlab excels is better set of default parameters. You don't have to worry so much about the line thicknesses, page width etc., as much as in the other options mentioned above. The cons side, obviously, is when you don't want the defaults. Easy things like packing your subplots close are not so easy in matlab. It's of course, nevertheless, still possible. Mainly with axis/plot handles.

Here's how you do it : first let's create our figs:

1: nsubs=3;
2: for isub=1:nsubs
3:  subplot(nsubs,1,isub);
4:  plot(rands(3,100)');
5:  set(gca,'fontsize',16);
6: end % for i=1:nsubs
7: savefigs('nopack_subplots','save demo of packed graphs',[]);

that's the result:

Figure 1: before

now , lets pack them:

 1: packing_const=0.06
 2: for isub=1:nsubs
 3:  h=subplot(nsubs,1,isub);p = get(h, 'pos');
 4:  if(isub<nsubs)
 5:   set(gca,'fontsize',16,'XTickLabelMode', 'Manual','XTickLabel', []);
 6:  else %  if(isub<nsubs)
 7:   set(gca,'fontsize',16);
 8:  end %  if(isub<nsubs) ... else ...
 9:  set(h,'pos',[p(1) p(2) p(3) p(4)+packing_const]);
10: end % for isub=1:nsubs
11: savefigs('pack_subplots','save demo of packed graphs',[]);

that's our "after" exhibit :

Figure 2: after

The "savefigs" function is non standard. Its aim is to save images in fig/eps/png formats at once, and generate README file and a mat file on the fly, with consistent names.

Copyright (C) 2015 by Avi Gozolchiani. See the License for information about copying.

org-mode source

Read and Post Comments