You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将Gnuplot中MD模拟DSSP图的X轴从帧数转换为纳秒?

Solution

Got it, let's tweak your Gnuplot script to display nanoseconds on the X-axis instead of frame counts—no need to edit your raw data at all. Here's the breakdown of the changes you need to make:

  • Update the X-axis label to reflect time instead of frames:
    Replace set xlabel "Frame" with set xlabel "Time (ns)"
  • Adjust the X-axis range to match the converted nanosecond value:
    Your max frame is 7002, so 7002 * 0.002 = 14.004 ns. Change set xrange [ 0.000:7002.000] to set xrange [0.000:14.004]
  • Map frame numbers to nanoseconds during plotting:
    Modify your splot command to multiply the first column (frame number) by 0.002 on the fly. Instead of splot "-" with pm3d title "hhhh.gnu", use:
    splot "-" using ($1*0.002):2:3 with pm3d title "hhhh.gnu"
  • Set custom X-axis ticks to show 0,1,2,...,14 ns:
    Add or replace the xtics setting with set xtics 0,1,14 (this sets start at 0, step by 1, end at 14)

Modified Script Snippet

set pm3d map corners2color c1
set ytics 1.000, 1.000
set ytics ("HM1_187@O2D-SER_137@OG-HG" 1.000,"HM1_187@O1D-SER_137@OG-HG" 2.000)
set xlabel "Time (ns)"  # Updated to reflect nanoseconds
set ylabel ""
set yrange [ 0.000: 4.000]
set xrange [0.000:14.004]  # Scaled to match max time in ns
set xtics 0,1,14  # Custom ticks for 0-14 ns
splot "-" using ($1*0.002):2:3 with pm3d title "hhhh.gnu"
1.000 1.000 1
1.000 2.000 0
1.000 3.000 0
2.000 1.000 1
2.000 2.000 1
2.000 3.000 0
# ... rest of your data lines

Quick Explanation

This approach keeps your original data completely intact—Gnuplot handles the frame-to-nanosecond conversion dynamically when plotting. The using ($1*0.002):2:3 syntax tells Gnuplot to:

  1. Take the first column (frame number) and multiply by 0.002 to get the time in nanoseconds
  2. Use the second column for the Y-axis values
  3. Use the third column for the color data required by pm3d

The custom xtics setting ensures your X-axis shows clean, integer nanosecond values exactly as you requested.

内容的提问来源于stack exchange,提问作者khalid

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:01:21