lib/rubyplot/backend/gr_wrapper.rb
# Set the window on the canvas within which the plotting will take place
# and then call the passed block for actual plotting.
Set the window on the canvas within which the plotting will take place
and then call the passed block for actual plotting.
Set the window on the canvas within which the plotting will take place and then call the passed block for actual plotting .
def within_window(abs=false, &block)
        vp_min_x = 0.0
        vp_max_x = 1.0
        vp_min_y = 0.0
        vp_max_y = 1.0
        if abs
          GR.setviewport(vp_min_x, vp_max_x, vp_min_y, vp_max_y)
          GR.setwindow(0,1,0,1)
        else
          vp_min_x = (@active_axes.abs_x + @active_axes.left_margin) / xspread
          vp_min_y = (@active_axes.abs_y + @active_axes.bottom_margin) / yspread
          vp_max_x = (@active_axes.abs_x + @active_axes.width -
            @active_axes.right_margin) / xspread
          vp_max_y = (@active_axes.abs_y + @active_axes.height -
            @active_axes.top_margin) / yspread
          GR.setviewport(vp_min_x, vp_max_x, vp_min_y, vp_max_y)
          GR.setwindow(
            @active_axes.x_range[0],
            @active_axes.x_range[1],
            @active_axes.y_range[0],
            @active_axes.y_range[1]
          )
        end
        block.call(vp_min_x, vp_max_x, vp_min_y, vp_max_y)
      end
def within_window ( abs = false , & block ) vp_min_x = 0.0 vp_max_x = 1.0 vp_min_y = 0.0 vp_max_y = 1.0 if abs GR . setviewport ( vp_min_x , vp_max_x , vp_min_y , vp_max_y ) GR . setwindow ( 0 , 1 , 0 , 1 ) else vp_min_x = ( @active_axes . abs_x + @active_axes . left_margin ) / xspread vp_min_y = ( @active_axes . abs_y + @active_axes . bottom_margin ) / yspread vp_max_x = ( @active_axes . abs_x + @active_axes . width - @active_axes . right_margin ) / xspread vp_max_y = ( @active_axes . abs_y + @active_axes . height - @active_axes . top_margin ) / yspread GR . setviewport ( vp_min_x , vp_max_x , vp_min_y , vp_max_y ) GR . setwindow ( @active_axes . x_range [ 0 ] , @active_axes . x_range [ 1 ] , @active_axes . y_range [ 0 ] , @active_axes . y_range [ 1 ] ) end block . call ( vp_min_x , vp_max_x , vp_min_y , vp_max_y ) end
Set the window on the canvas within which the plotting will take place
and then call the passed block for actual plotting.
Set the window on the canvas within which the plotting will take place and then call the passed block for actual plotting .
abs
block