set mouse mouseformat

seems not to work when specifying format that includes timedate data.

set mouseformat 3

gives you timedate vs y-axis, timedate format being previously specified with set timefmt. But if you explicitly provide timedate format to the mouseformat statement, it gets nuts: for example,

set mouse mouseformat "%d %4.1f"

will not give day number as x value, but a weird number (if, rather, you provide %g, it will give you seconds). I know

set mouse mouseformat 3

would be just fine, but not if you want y-axis value with a user-defined format, nor if you want to get rid of the square brackets and comma between x and y value. Anyone knows how to deal with it?

1 Answer 1


Thx to Ethan Merritt, here is the answer (with a very slight change at the end):

Note that the format is fed to sprintf, which doesn't know anything about time or date. %d is C standard format for decimal integer, and that is what sprintf will treat it as.

If you want to custom format a time string I think you have to do it using something like:

set mouse mouseformat function strftime("%d",x).' ,'.gprintf("%.2f",y)

where the x coordinate is fed through a time format and the y coordinate is fed through a normal format.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .