5

I want to make a scatterplot with Gnuplot of these data (1st column as x-coordinates):

2015.493379 5 
2015.505479 5 
2015.513699 25 
2015.530137 25 
2015.532877 20 
2015.543836 5 
2015.552055 5 
2015.554795 10 
2015.563014 15 
2015.565753 15 
2015.582192 10

I'm using this command:

plot "file.txt" u 1:2

The problem is the x-axis precision: gnuplot truncates the first column numbers at the first two decimals (2015.49, 2015.50, etc). I tried to change the x format (format x %.6f for ex) but it does not change the precision: x-tics just become 2015.490000, etc instead of 2015.49, whereas I want 2015.493379, etc, and the mouse pointer does not give extra information (in the bottom-left corner, the coordinates of the point pointed by the mouse have the same precision).

Do you know how to tell gnuplot to take the entire number into account ?

4

Instead of changing the format of tics, change the format of the axis

set format x "%.6f"

You might then need to set the xtics format to a different one

set xtics format "%.4f"

If you want to change where xtics start and how often they tic, use the following syntax:

set xtics 2015.49337, 0.01

To change the format of the coordinates shown for the mouse pointer, use the mouse option:

set mouse format '%.6f'
  • I used this command to change the format of tics, and it does what I've described in the first post – JoVe Jul 28 '15 at 12:41
  • @JoVe: Oh, you mean you want to change where xtics start? Check the update. – choroba Jul 28 '15 at 12:47
  • No that's not what I meant. I want to change the precision of the numbers displayed. When I move the mouse pointer on the graph, the (x,y) coordinates are displayed in the bottom left corner: they are truncated at the 2nd decimal (2015.xx instead of the 2015.xxxxxx I want). And the same is done with the tics (2015.xx0000 when I force gnuplot to display more digits). I need a higher precision to know which point corresponds to what. Am i clearer ? – JoVe Jul 28 '15 at 13:03
  • @JoVe: I still don't get it. If a tic corresponds to 2015.51, why should it display any non-zero digits after the 1 at the end? – choroba Jul 28 '15 at 13:11
  • Okay, the value of the tic is not important. Let's assume the tics are 2015.49, 2015.50 etc. I have two points between 2015.53 and 2015.54: I want to know the exact value (as wirtten in my data file) of the x-coordinate of one point when I hoover my mouse over it. Gnuplot displays the coordinates of the mouse pointer in the bottom-left corner, but the precision is the same as the x-tics. Thus, when I hover over my points between 2015.53 and 2015.54, the x-value displayed is 2015.53 for both points, instead of 2015.530137 and 2015.532877. – JoVe Jul 28 '15 at 13:20

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.