2

I am using gracebat of xmgrace to generate images based on xvg inputs:

gracebat input.xvg -hdevice PNG -nosafe -printfile ouptut.png -hardcopy -batch grace.bfile

and here is my batch file

s0 line type 0
s0 type BAR
s0 line color 4
HARDCOPY DEVICE \"PNG\"
PAGE SIZE 800, 600
xaxis label char size 2.50000
yaxis label char size 2.50000
xaxis ticklabel char size 2.000000
yaxis ticklabel char size 2.000000

Briefly it produces what I need but I would like to customuze in the batch.file design of the bar graphs. How it could be possible to set blue background for each bar (presently it is white) as well as to increase the thickness of the black line of the outline of each bar?

0
1

The outline thickness can be modified as well as its color, but (in the stable version?) only a black background can be set from the batch file. Available batch settings are listed in the command interpreter reference.

## Outline color to blue.
S0 SYMBOL COLOR 4

## Bar fill. Only 1 (black) is available.
S0 SYMBOL FILL 1

## This should fill the bars with any color but it doesn't (at least in the
## stable release, 5.1.25).
# S0 FILL WITH COLOR
# S0 FILL COLOR 3

## Outline width.
S0 SYMBOL LINEWIDTH 2

## Bonus: Thicker frame outline.
FRAME LINEWIDTH 3
XAXIS TICK MAJOR LINEWIDTH 2
XAXIS TICK MINOR LINEWIDTH 2
YAXIS TICK MAJOR LINEWIDTH 2
YAXIS TICK MINOR LINEWIDTH 2

## This is what you already had.
S0 LINE TYPE 0
S0 TYPE BAR
HARDCOPY DEVICE "PNG"
PAGE SIZE 800, 600
XAXIS LABEL CHAR SIZE 2.50000
YAXIS LABEL CHAR SIZE 2.50000
XAXIS TICKLABEL CHAR SIZE 2.000000
YAXIS TICKLABEL CHAR SIZE 2.000000

Result of running the batch script

If you insist in a blue bar background color, using the GUI is necessary, but at least all other parameters will already be set if you launch it thus:

xmgrace -batch grace.bfile -nosafe input.xvg &

Then click Plot > Set appearance > Symbols and choose a symbol fill color. Accept, and CTRL-P to create the PNG file.

2
  • thank you very much! In my case with your script I obrained violet bar graph :-) I am going to show you it in my first topic. And yes it is not possible to further modify the color. BTW I did not understand what your bonus options do .. – user3470313 Oct 23 '20 at 14:11
  • @user3470313 You are welcome! The bonus changes the frame thickness. Try increasing it from 2 to 5 to make the difference more noticeable. – Quasímodo Oct 23 '20 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.