Gnuplot:功率符号轴

时间:2019-06-27 16:37:28

标签: gnuplot

我将y轴设置为幂表示法(1.0e + 5或1.0 * 1.0 ^ 5),但我想仅在轴顶部报告功率,以节省空间。特别是,我想报告链接末尾的轴的末端

https://imgur.com/a/eDc0FW2

2 个答案:

答案 0 :(得分:1)

尝试使用此注释代码:

# 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

答案 1 :(得分:0)

我想将前置因子放在标签中(而不是轴的顶部)是很常见的。如果您绝对需要它,请告诉我。一种方法如下。还有一些方法可以自动确定前置因子。

代码:

func getFrames(forRow row: Int, forColoumn col: Int) -> CGRect{
    print(vc.SPACE_FROM_TOP_EDGE)
    print(vc.TILE_SIZE)
    let x =   (CGFloat(col) * 40.0)
    let y =  vc.SPACE_FROM_TOP_EDGE! + (CGFloat(row) * 40.0)

    return CGRect(origin: CGPoint(x: x, y: y), size: CGSize(width: 40.0, height: 40.0))
}

结果:

enter image description here