0

I am interesting what command should be added within the file of xmgrace 2D plot in order to set up the ranges for the Y-axis having a file.arg in the following format:

@    title  "title"
@    xaxis  label "Frame"
@    yaxis  label "Number of hits"
@TYPE xy
0    0
1    1
2    3
3    8
4    7
5    8
6    8
7    8
8    8
9    12

E.g in that graph the data along Y is varied from 0 to 12. With the default xmgrace settings I have a graph where the maximum value along Y set up as 40 (with the empty data because in fact there is no values above 12), which is not good for the visualization. What command I can add to the arg file in order to fix the range along Y?

1 Answers1

0

The line you need is

@world x_min, y_min, x_max, y_max

However in your case you also need to put a header on top of the file, so that the whole thing becomes

@version 50125
@world 0, 0, 9, 12
@title  "title"
@xaxis  label "Frame"
@yaxis  label "Number of hits"
@TYPE xy
0    0
1    1
2    3
3    8
4    7
5    8
6    8
7    8
8    8
9    12

You can also set the x_min, y_min, x_max and y_max values separately like this:

@world xmin 0
@world xmax 10
@world ymin 9
@world ymax 12

If you really want to edit xmgrace files by hand, I would recommend to use something like pygrace, or to use the grace built-in batch capabilities, which have been covered before here on SO (here or here, for example).

lr1985
  • 1,085
  • 1
  • 9
  • 21
  • Thank you! Yep, for that particular case your solution is better for my case. One question: the @world 0, 0, 9, 12 specify the dimensions both for X and Y. Is it possible to modify only Y, while keeping X as the automatically adjusted? Thanks in advance ! –  Mar 28 '18 at 13:37
  • Yes, it is possible. I have expanded the answer to also cover this case. – lr1985 Mar 28 '18 at 13:44
  • Happy to help! If this answer or any other one solved your issue, please mark it as accepted by clicking the green check mark. This helps to more easily find questions that still don't have answers. – lr1985 Mar 28 '18 at 15:39
  • what does the parameter world do? Can I use it to pass it as a one line argument to shift the yaxis? I piping grep results into grace. – pUTa432 May 07 '22 at 16:19