Gnuplot: ось обозначения мощности - PullRequest
0 голосов
/ 27 июня 2019

Я установил ось Y в степенной нотации (1,0e + 5 или 1,0 * 1,0 ^ 5), но я хотел бы сообщить о мощности только в верхней части оси, чтобы сэкономить место. В частности, я хотел бы сообщить в конце оси, как указано в ссылке

https://imgur.com/a/eDc0FW2

Ответы [ 2 ]

1 голос
/ 28 июня 2019

Попробуйте использовать этот комментарий:

# Creating some 'x y' data to plot and
# save output using 'table' and 
# datablock named 'data'
set table $data
    plot (1E-5 + sin(x)*1E-5)
unset table

# Performs statistics using 'y' column 
# to find max value, turn off output, and
# set prefix name 'data' to stats results
stats $data u 2 nooutput name 'data'

set tmargin at screen 0.94    # Change the top margin

# Define a label containing the power to base 10
# of max value from data and put on top-left
# using the same value of top margin 
# but using offset on y axis
set label gprintf('×10^{%T}',data_max) at graph 0.0, screen 0.94 offset 0,0.75


set format y '%.2t'  # Format for 'y' values using mantissa 
                     # to base 10 and 2 decimal places

set xlabel 't'       # label to 'x' axis
set ylabel 'Ω'       # label to 'y' axis
unset key            # Turn off key (legend)
set tics nomirror    # Turn off upper and right tic marks

# The plot itself
plot $data using 1:2 w l

Производит

plot

0 голосов
/ 27 июня 2019

Я полагаю, очень распространено помещать префактор в метку (вместо верхней части оси). Если вам это абсолютно необходимо, дайте мне знать. Одним из способов было бы следующее. Также могут быть способы автоматического определения префактора.

Код:

### prefactor for axis
reset session

Power = 5
set format y "%.2f"
set ylabel sprintf("Ω [10^%d rpm]", Power) enhanced

f(x) = 3e4*sin(x)+1.2e5

plot f(x)/10**Power w l notitle
### end of code

Результат:

enter image description here

...