Make sure figure legends are adapted to xmgr/xmgrace

A few programs were not using the xvgr_legend call. g_mdmat
has been modified to use it, and for g_analyse and g_enemat
I at least fixed the existing direct-writing code by adding
a conditional.

Fixes #783.

Change-Id: I782af539b93737b570f266ba744e718fbd846e5f