Gnuplot隐藏命令行提示终端

时间:2014-01-02 18:25:02

标签: ruby windows terminal gnuplot command-prompt

我在我的一个应用程序中运行Gnuplot,每次生成图形并运行可执行文件时,Windows命令行提示会在关闭之前显示一小段时间。有没有办法隐藏终端并防止其显示?

以下是我正在使用的代码的一部分:

# Create gnuplot
Gnuplot.open do |gp|
    Gnuplot::Plot.new( gp ) do |plot|
        plot.set("terminal", "png small size 800,500")
        plot.set("title", File.basename(@current_epw_file))
        plot.set("ylabel", "\"y1\" rotate by 0")
        plot.set("y2label", "\"y2\" rotate by 0")
        plot.set("bmargin", "7")
        if (@show_grid)
            plot.set("grid")
        end

        plot.set("xdata","time")
        plot.set("timefmt", "\"%m/%d %H:%M\"")
        plot.set("format", "x \"%m/%d\\n%H:%M\"")
        plot.set("xrange", xrange)
        plot.set("y2tics")
        plot.set("key", "under")

        # Insert day markers if that option is selected
        if (@mark_days)
            day_markers = generate_day_markers(xrange)
            day_markers.each do |marker|
                plot.set("arrow", "from \"#{marker} 0:00\",graph(0,0) to \"#{marker} 0:00\",graph(1,1) nohead")
            end
        end

        plot.set("output", "weather_display.png")
        plot.data = []

        # Load all the data sets
        for file in dataset_files
            plot.data << Gnuplot::DataSet.new( "'#{file}'" ) do |ds|
                weather_parameter_object = @requested_parameters.slice!(0)

                ds.with = @with_value

                # Check thick lines option
                if (!@thick_lines)
                    ds.linewidth = 1
                else
                    ds.linewidth = 2
                end

                ds.using = "1:3"
                y_axis = @parameter_axes.slice!(0)
                ds.axes = "x1y#{y_axis}"
                if (using_both_axes)
                    ds.title = "#{weather_parameter_object.name} (#{weather_parameter_object.units}) [y#{y_axis}]"
                else
                    ds.title = "#{weather_parameter_object.name} (#{weather_parameter_object.units})"
                end
            end 
        end
    end

    path = Plugin.dir + "/lib/ruby/ruby/gems/1.8/gems/gnuplot-2.6.2/gnuplot/bin/weather_display.png"
    while (File.exists?(path) and File.size(path) > 0)
        # Wait until image has been created
    end

end

0 个答案:

没有答案