Exponential format of axis label in gnuplot

30 Views Asked by At

How to set the format to have 10^{%L} only ones above or next to the axis, not near each number? Thank you

set format y "%2.0t{/Symbol \327}10^{%L}"
set format x "%2.0t{/Symbol \327}10^{%L}"
1

There are 1 best solutions below

0
theozh On BEST ANSWER

If you want a prefactor at the axes you simply create a label there. Something like the example below.

Note: Check help format_specifiers: there is %t and %T which belong together and %l and %L. Although you don't need these formats in the example below, it might be good to avoid confusion in case you might have different log scales.

Script:

### prefactors on axes
reset session

set format x "%.0f"
set format y "% 4.0f"

# create some test data
set table $Data
    plot [0:10000] x**2
unset table

factorX    = 100
factorY    = 100000

set xlabel "x-label"
set ylabel "y-label"
set rmargin 7
set tmargin 3

set label 1 at graph 1, 0 sprintf("× 10^{%d}",log10(factorX)) offset 0.5,0.3
set label 2 at graph 0, 1 sprintf("× 10^{%d}",log10(factorY)) offset 0,0.7

plot $Data u ($1/factorX):($2/factorY) w l lc "red" ti "data"
### end of script

Result:

enter image description here