Gnuplot画布:缩放时抽搐消失

Gnuplot canvas: tics disappear on zoom

本文关键字:抽搐 消失 缩放 画布 Gnuplot      更新时间:2023-09-26

我已经在一个与我的工作相关的web界面上工作了一段时间。我有一些数据可以迭代地与模型拟合。在每一次迭代中,我都会创建一个Gnuplot图形,该图形将上线以帮助我跟踪过程。它工作得很好,然而,我有一些与画布终端有关的小问题,我很长一段时间都无法修复。我使用Gnuplot 4.6.5和几个浏览器。他们的行为始终如一。

下面是这样一个页面的例子,有两个数字:http://stelweb.asu.cas.cz/~nemeth/xtgrid_log/xtgrid-008_r1458384bfCsdd_dat.html

我在x轴的抽搐和分辨率方面有点困难,我认为这些问题可能与有关

图下方的1-x轴坐标不显示小数。我认为x坐标被Gnuplot截断了。

当我们放大时,2轴抽搐消失。

3-我有一些标签定义为:"将标签设置为x,屏幕0.2'…一些标签…'"这些标签在放大时会消失,即使它们被设置为屏幕y坐标(0.2(

4-当鼠标移到图2并再次移回1时,图1中的缩放重置。这可能是一个html/java问题。

生成这些数字的Gnuplot脚本如下所示:

set encoding iso_8859_1
set terminal canvas solid butt size 1024,410 name figure1  mousing lw 0.7 
set output "figure1.js"
set samples 50, 50
set size ratio 0.4
set xtics autofreq 200
set mxtics 4
set xr [4000:5000]
set ylab "Relative flux"
set xlab "Wavelength ('305)"
set format y "%1.1e"
load 'lines.gnp' # just a bunch of labels
plot " ... some file ... "

我想知道这些不便是否有一个普遍的解决办法。

对于问题4:Gnuplot生成的javascript启动如下:

function ALue310128bfCsdd_dat_7_0() 
  {
  canvas = document.getElementById("ALue310128bfCsdd_dat_7_0");
  ctx = canvas.getContext("2d");
  // Reinitialize mouse tracking and zoom for this particular plot
  if ((typeof(gnuplot.active_plot) == "undefined" || gnuplot.active_plot != ALue310128bfCsdd_dat_7_0)  &&  typeof(gnuplot.mouse_update) != "undefined")
    {
    gnuplot.active_plot_name = "ALue310128bfCsdd_dat_7_0";
    gnuplot.active_plot = ALue310128bfCsdd_dat_7_0;
    canvas.onmousemove = gnuplot.mouse_update;
    canvas.onmouseup = gnuplot.zoom_in;
    canvas.onmousedown = gnuplot.saveclick;
    canvas.onkeypress = gnuplot.do_hotkey;
    if (canvas.attachEvent) {canvas.attachEvent('mouseover', ALue310128bfCsdd_dat_7_0);
    }
  else if (canvas.addEventListener) 
    {canvas.addEventListener('mouseover',   ALue310128bfCsdd_dat_7_0, false);}
  gnuplot.zoomed = false;
  gnuplot.zoom_axis_width = 0;
  gnuplot.zoom_in_progress = false;
  gnuplot.polar_mode = false;
  ctx.clearRect(0,0,1280,513);
  }

gnuplot.zoomedgnuplot.zoom_in_progress变量似乎与缩放级别的重新初始化有关。

  1. 如果你指的是鼠标框的坐标:例如wxt,这些鼠标坐标的格式适用于set mouse format。这对canvas终端不起作用,可能是一个错误。

  2. gnuplot创建图像后,轴抽搐仅变为线条,即缩放时不会重新生成轴抽搐。试着放大一个tic:它会变得很大。

  3. 与2相同:screen坐标仅在gnuplot中被识别为这样。写入文件后,只有绝对坐标。如果标签坐标落入缩放区域,则绘制相应的标签,否则不绘制。

  4. 这可能是一个错误,也可以在例如。http://gnuplot.sourceforge.net/demo_canvas_5.0/finance.html

我认为1。和4。可能是虫子。和3。是目前提供的交互性的限制,也可能是gnuplot本身产生此类图像的限制。

也许它值得您测试gnuplot JS(在http://gnuplot.respawned.com/)。我还没试过。