This may be useful if the legend text is long and the graph has some empty vertical space on one side. Can the legend be in the green box with text going vertically (see figure below)?
2 Answers
This is not possible in xmgrace directly (unless you use a cumbersome workaround). But if you export your plot as an SVG file (or PS or any other vector format) you can rotate the legend using external software such as Inkscape.
Exporting a SVG in xmgrace
File > Print setup...
then change "Device" to "SVG". Modify the File name and then click "Apply".
Importing the SVG in Inkscape and rotating the legend
In Inkscape, use
File > Import
to import the SVG file. Once imported, select the plot with the mouse and un-group it. This breaks the vector image into separate objects.Next, select all of the legend objects (e.g. the legend border, background, text and lines or markers) and group them together.
Now rotate this new "legend" group 90 degrees clock-wise.
You can then adjust the position of the legend box.
Scripting
It is surely possible to script this process, either using some exsting Python SVG library or by writing your own script that parses the SVG (which is just XML markup after all) and makes some modifications.

- 3,431
- 2
- 36
- 61
No, it's not possible. However, there is a workaround you can use. It's quite the cumbersome procedure, but I don't think there are other options:
- Set " " (a single space) as the legend
- Move it where you want
- Move the "Window -> Drawing objects..." dialog
- Add the real legend as text, set "rotation" to 90 or 270
- Click on "move object" and move it just below the (empty) legend
This should result in something like this:
If you want to have a vertical line then you have to do it yourself by adding a line (from the same dialog) and giving it the right colour. This is the end result:

- 1,085
- 1
- 9
- 21
-
Thanks. The second figure is just the thing I want. However, this would be a way to do it if I had to do it just once. I was wondering if the legend box could be treated as an object whose properties, such as orientation, could be modified. The settings could then be saved in a parameter file and used again and again. I guess until the grace developers put in this feature, this is what we have. – Saurish Chakrabarty Oct 01 '18 at 10:09
-
@SaurishChakrabarty As I said, unfortunately that is not possible. As for hoping that the developers will implement it, I don't think that's going to happen. The development of xmgrace has stopped I believe :-( – lr1985 Oct 01 '18 at 11:57