37

I am using really big numbers (milions) on my x-axis, so when I use

set format x %6.0f

I got big numbers like 25000000. That is quite nice, but takes much space, so there are only few labels and reader losts information.

When I exclude setting format, I get something like 2e+07, what is quite unfriendly and unusual to reader according to my opinion.

I would like format like 25*(10^6), so the number would be first and then multiplied by 10^n, or something very similiar to that. I think that would be the best solution, if the x-axis is long about 30000000 points or even more.

However, reading manuals, e.g. "How do I change the format of the numbers ?" from http://t16web.lanl.gov/Kawano/gnuplot/tics-e.html did not help me much.

Thank you in advance.

David L.
  • 2,095
  • 23
  • 23
Perlnika
  • 4,796
  • 8
  • 36
  • 47

2 Answers2

40

All format specifiers that gnuplot has to offer can be found here.

If you don't like the 2e+07 format you could try setting the format with

set format x "%.0s*10^{%T}"

which gives you a format like 15*10^6.

m93a
  • 8,866
  • 9
  • 40
  • 58
Woltan
  • 13,723
  • 15
  • 78
  • 104
  • Thanks a lot!!! You brought me to idea of %.0s MB, what looks really pretty! ;-) Thats exactly what I needed. – Perlnika Nov 03 '11 at 12:24
  • Note that this will use _engineering_ notation instead of scientific. This means that instead of e.g. 2×10⁷ you'll get 20×10⁶. For scientific notation see the [answer by sri](https://stackoverflow.com/a/45481272/673852). – Ruslan Jan 17 '21 at 21:30
  • Not working for me in gnuplot 5.4 patchlevel 1. Resulting x ticks are like `15*10^{113*10^{832`. – SSilk Jun 02 '23 at 10:39
7

Also one can use the following to obtain scientific notation with cross symbol: 2x10^6

set format x "%2.0t{/Symbol \264}10^{%L}"

sri
  • 71
  • 1
  • 4
  • On my gnuplot 5.0 compiled on Linux I get normal cross symbol even with literal "×" character. – Ruslan Jan 17 '21 at 21:33
  • On 5.4 patchlevel 1, this gives me a complaint `Format character mismatch: %L is only valid with %l` when I actually try to plot. And the actual result doesn't seem right. It's giving x axis ticks like `1{/Symb 8{/Sym 6{/Symb 5{/Sym`. – SSilk Jun 02 '23 at 10:38