# File ../../lib/numru/ganalysis/histogram.rb, line 171 def histogram(gphys, newframe=true, options=nil) gropn_1_if_not_yet if newframe!=true && newframe!=false raise ArgumentError, "2nd arg (newframe) must be true of false" end unless gphys.rank == 1 raise ArgumentError, "rank of gphys must be 1" end unless gphys.axis(0).cell? raise ArgumentError, "axis must be cell type" end # if window is specified via GGraph#fig or GGraph#set_fig, use it. opts = @@histogram_options.interpret(options) exchange = opts["exchange"] raise "Option 'window' must be an Array of length == 4" unless opts["window"].is_a?(Array) && opts["window"].length == 4 window = opts["window"].dup 4.times{|i| window[i] ||= @@fig['window'][i]} if @@fig['window'] 4.times{|i| window[i] ||= DCL::sgqwnd[i]} unless newframe unless exchange x = gphys.axis(0).cell_bounds y = gphys window[2] ||= 0 else y = gphys.axis(0).cell_bounds x = gphys window[0] ||= 0 end itr = @@fig['itr'] || DCL::sgpget("itr") if (itr==2 || itr==4) tmp = y.val if tmp.min * tmp.max < 0 if tmp.min.abs < tmp.max mask = tmp.lt(0) else mask = tmp.gt(0) end else mask = tmp.ne(0) end if tmp.is_a?(NArrayMiss) tmp.set_mask(mask * tmp.get_mask) else tmp = NArrayMiss.to_nam_no_dup(tmp, mask) end y.replace_val(tmp) if(window[2].nil? || window[2] == 0) window[2] = tmp.abs.min * (tmp.min < 0 ? -1 : 1) end end if (itr==3 || itr==4) tmp = x.val if tmp.min * tmp.max < 0 if tmp.min.abs < tmp.max mask = tmp.lt(0) else mask = tmp.gt(0) end else mask = tmp.ne(0) end if tmp.is_a?(NArrayMiss) tmp.set_mask(mask * tmp.get_mask) else tmp = NArrayMiss.to_nam_no_dup(tmp, mask) end x.replace_val(tmp) if(window[0].nil? || window[0] == 0) window[0] = tmp.abs.min * (tmp.min < 0 ? -1 : 1) end end opts["window"] = window fig(x, y, "window" => window) if newframe lmiss = DCL::gllget("lmiss") DCL::gllset("lmiss", true) if opts["fill"] itps = DCL::uuqarp itps[0] = itps[1] = opts["fill_pattern"] if opts["fill_pattern"] DCL::uusarp(*itps) end unless exchange if opts["fill"] DCL::uvbxa(x.val, [window[2]] * y.length, y.val) end bottom = [window[2]] * y.length DCL::uvbxf(x.val, bottom, y.val) else if opts["fill"] DCL::uhbxa([window[0]] * x.length, x.val, y.val) end bottom = [window[0]] * x.length DCL::uhbxf(bottom, x.val, y.val) end DCL::gllset("lmiss", lmiss) axes(x, y, "title" => opts["title"]) if newframe return nil end
Generated with the Darkfish Rdoc Generator 2.