# File lib/sparklines.rb, line 88
    def plot_to_image(data=[], options={})
      defaults = {
        :type             => 'smooth',
        :height           => 14,
        :upper            => 50,
        :diameter         => 20,
        :step             => 2,
        :line_color       => 'lightgrey',

        :above_color      => 'red',
        :below_color      => 'grey',
        :background_color => 'white',
        :share_color      => 'red',
        :remain_color     => 'lightgrey',
        :min_color        => 'blue',
        :max_color        => 'green',
        :last_color       => 'red',
        :std_dev_color    => '#efefef',

        :has_min          => false,
        :has_max          => false,
        :has_last         => false,
        :has_std_dev      => false,

        :label            => nil
      }

      # HACK for HashWithIndifferentAccess
      options_sym = Hash.new
      options.keys.each do |key|
        options_sym[key.to_sym] = options[key]
      end

      options_sym  = defaults.merge(options_sym)

      # Call the appropriate method for actual plotting.
      sparkline = self.new(data, options_sym)
      if %w(area bar bullet pie smooth discrete whisker).include? options_sym[:type]
        sparkline.send options_sym[:type]
      else
        sparkline.plot_error options_sym
      end
    end