-1

I am using gracebat integrated into my bash script to make simple XY graph from 2D numerical data

gracebat input.xvg -hdevice PNG -fixed 800 600 -world 0 0.02 610 0.5 -printfile output.png -hardcopy

This simple execution without GUI produces the XY graph totally in black color! enter image description here would it be possible to quickly change to color of the line (I guess should be s0 color in the batch file) without using batch file for gracebat: e.g. via some option of gracebat or alternatively via editing of the input.xvg (via sed or any shell utility) specifying color or the line:

@ s0 line color 2 

Alternatively, if the grace has not good possibilities for graph customization, I would be grateful for simple example of the gnuplot batch execution.

James Starlight
  • 317
  • 1
  • 6
  • 1
    So, you are asking for a xmgrace and/or gnuplot command line for plotting data from a file with a red line. What have you tried? Have you checked the manuals (RT*M)? In gnuplot have you checked `help command line options`? Please show some own research effort. https://stackoverflow.com/help/how-to-ask – theozh Oct 11 '22 at 16:11
  • actually the question was mainly related to xmgrace since it's easy to execute it from batch for such simple tasks. however, if it's not possible to change the graph color w/o GUI I would definetely try the Gnuplot for such graph. Cheers – James Starlight Oct 12 '22 at 08:13

1 Answers1

1

What does xmgrace -help say? Please check the corresponding manuals and homepages and do a search on SO and the web before asking such questions. I don't now xmgrace and its documentation.

But a gnuplot command line would be using the command line option -e: (check help command line options).

gnuplot -e "set term pngcairo size 800,600; set output 'myFile.png'; plot 'myFile.dat' u 1:2 w l lc 'red' "
theozh
  • 22,244
  • 5
  • 28
  • 72
  • great! thank you very much! just a few question related to gnuplot : how to disable legend on the graph (it plots now the name and full path of the input xvg directly on the graph) ? how would it be possible to increase the thickness of the produced color line ? – James Starlight Oct 12 '22 at 10:30
  • Great, I gotcha thank you very much! Actually this is one of my first experience with gnuplot but I will use it now instead of xmgrace. It's so cool! – James Starlight Oct 12 '22 at 10:39
  • probably just one minor question about using bash variables inside your gnuplot script. E.g. I added there ; set title 'RMSF of ${simulation}'; where simulation is the name of the xvg. It prints correctly the name of the file but the format is alitle bit strange e.g. it scips the "_" characters from the file name – James Starlight Oct 12 '22 at 10:47
  • 1
    @JamesStarlight ok, as a beginner there are a lot of pitfalls and unknowns. You probably have to set `set title ... noenhanced` or maybe `set termoption noenhanced`. In enhanced text mode `_` is used for subscript. Check `help enhanced`. Basically for every command there is a help entry. Please always check ` help ` and read it carefully **before** asking. In your case this would have been `help title`. – theozh Oct 12 '22 at 10:56