Index: lib/gruff/line.rb
===================================================================
--- lib/gruff/line.rb   (revision 68)
+++ lib/gruff/line.rb   (revision 71)
@@ -11,6 +11,11 @@

   # Hide parts of the graph to fit more datapoints, or for a different appearance.
   attr_accessor :hide_dots, :hide_lines
+
+  # MK: I would like to be able to set the line width
+  attr_accessor :line_stroke_width
+  attr_accessor :baseline_stroke_width
+  attr_accessor :dot_stroke_width

   # Call with target pixel width of graph (800, 400, 300), and/or 'false' to omit lines (points only).
   #
@@ -32,6 +37,10 @@
     @hide_dots = @hide_lines = false
     @baseline_color = 'red'
     @baseline_value = nil
+    # MK: I want to be able to set the line width
+    @line_stroke_width = 5
+    @dot_stroke_width = 5
+    @baseline_stroke_width = 5
   end

   def draw
@@ -48,7 +57,7 @@
       @d.stroke_color @baseline_color
       @d.fill_opacity 0.0
       @d.stroke_dasharray(10, 20)
-      @d.stroke_width 5
+      @d.stroke_width (@baseline_stroke_width > 0 ? @baseline_stroke_width : 5)
       @d.line(@graph_left, level, @graph_left + @graph_width, level)
       @d = @d.pop
     end
@@ -68,12 +77,12 @@
         @d = @d.stroke data_row[DATA_COLOR_INDEX]
         @d = @d.fill data_row[DATA_COLOR_INDEX]
         @d = @d.stroke_opacity 1.0
-        @d = @d.stroke_width clip_value_if_greater_than(@columns / (@norm_data.first[1].size * 4), 5.0)
+        @d = @d.stroke_width clip_value_if_greater_than(@columns / (@norm_data.first[1].size * 4), @line_stroke_width)

         if !@hide_lines and !prev_x.nil? and !prev_y.nil? then
           @d = @d.line(prev_x, prev_y, new_x, new_y)
         end
-        circle_radius = clip_value_if_greater_than(@columns / (@norm_data.first[1].size * 2.5), 5.0)
+        circle_radius = clip_value_if_greater_than(@columns / (@norm_data.first[1].size * 2.5), @dot_stroke_width)
         @d = @d.circle(new_x, new_y, new_x - circle_radius, new_y) unless @hide_dots

         prev_x = new_x
Index: lib/gruff/base.rb
===================================================================
--- lib/gruff/base.rb   (revision 68)
+++ lib/gruff/base.rb   (revision 71)
@@ -34,12 +34,25 @@
     DATA_LABEL_INDEX = 0
     DATA_VALUES_INDEX = 1
     DATA_COLOR_INDEX = 2
+
+    # MK: Minimums, see below.
+    MIN_MARGIN = {
+                    :top_margin => 5.0,
+                    :bottom_margin => 5.0,
+                    :right_margin => 5.0,
+                    :left_margin => 5.0,
+                    :text_margin => 5.0,
+                    :label_margin => 2.0,
+                    :title_margin => 5.0
+                 }

     # Blank space around the edges of the graph
-    TOP_MARGIN = BOTTOM_MARGIN = RIGHT_MARGIN = LEFT_MARGIN = 20.0
+    # MK: I don't like this being a constant, but I do like the idea of a
+    # set of minimums.  Leaving these here for now.
+    TOP_MARGIN = BOTTOM_MARGIN = RIGHT_MARGIN = LEFT_MARGIN = (MIN_MARGIN[:top_margin] * 4.0)

     # Space around text elements. Mostly used for vertical spacing
-    LEGEND_MARGIN = TITLE_MARGIN = LABEL_MARGIN = 10.0
+    LEGEND_MARGIN = TITLE_MARGIN = LABEL_MARGIN = (MIN_MARGIN[:text_margin] * 2.0)

     # A hash of names for the individual columns, where the key is the array index for the column this label represents.
     #
@@ -131,6 +144,11 @@
     # Will be scaled down if graph is smaller than 800px wide.
     attr_accessor :legend_box_size

+    # MK: I only use readers for the margins as the writer needs to do minimum checks
+    attr_reader :top_margin
+    attr_reader :bottom_margin
+    attr_reader :left_margin
+    attr_reader :right_margin

     # If one numerical argument is given, the graph is drawn at 4/3 ratio according to the given width (800 results in 800x600, 400 gives 400x300, etc.).
     #
@@ -175,6 +193,12 @@
       @labels_seen = Hash.new
       @sort = true
       @title = nil
+
+      # MK: Initial margins
+      @top_margin = TOP_MARGIN
+      @bottom_margin = BOTTOM_MARGIN
+      @left_margin = LEFT_MARGIN
+      @right_margin = RIGHT_MARGIN

       @scale = @columns / @raw_columns

@@ -378,6 +402,42 @@
       end
     end

+    # Sets the margin after checking the value against minimums and image size.
+    def top_margin= (margin=MIN_MARGIN[:top_margin])
+      if margin < MIN_MARGIN[:top_margin]
+        @top_margin = MIN_MARGIN[:top_margin]
+      else
+        @top_margin = margin
+      end
+    end
+
+    # Sets the margin after checking the value against minimums and image size.
+    def bottom_margin= (margin=MIN_MARGIN[:bottom_margin])
+      if margin < MIN_MARGIN[:bottom_margin]
+        @bottom_margin = MIN_MARGIN[:bottom_margin]
+      else
+        @bottom_margin = margin
+      end
+    end
+
+    # Sets the margin after checking the value against minimums and image size.
+    def left_margin= (margin=MIN_MARGIN[:left_margin])
+      if margin < MIN_MARGIN[:left_margin]
+        @left_margin = MIN_MARGIN[:left_margin]
+      else
+        @left_margin = margin
+      end
+    end
+
+    # Sets the margin after checking the value against minimums and image size.
+    def right_margin= (margin=MIN_MARGIN[:right_margin])
+      if margin < MIN_MARGIN[:right_margin]
+        @right_margin = MIN_MARGIN[:right_margin]
+      else
+        @right_margin = margin
+      end
+    end
+
     # Writes the graph to a file. Defaults to 'graph.png'
     #
     # Example: write('graphs/my_pretty_graph.png')
@@ -405,8 +465,8 @@

       debug {
         # Outer margin
-        @d.rectangle( LEFT_MARGIN, TOP_MARGIN,
-                            @raw_columns - RIGHT_MARGIN, @raw_rows - BOTTOM_MARGIN)
+        @d.rectangle( @left_margin, @top_margin,
+                            @raw_columns - @right_margin, @raw_rows - @bottom_margin)
         # Graph area box
         @d.rectangle( @graph_left, @graph_top, @graph_right, @graph_bottom)
       }
@@ -474,7 +534,7 @@
       if @hide_line_markers
         (@graph_left,
          @graph_right_margin,
-         @graph_bottom_margin) = [LEFT_MARGIN, RIGHT_MARGIN, BOTTOM_MARGIN]
+         @graph_bottom_margin) = [@left_margin, @right_margin, @bottom_margin]
       else
         longest_left_label_width = 0
         if @has_left_labels
@@ -490,7 +550,7 @@
                               0.0 :
                               (longest_left_label_width + LABEL_MARGIN * 2)

-        @graph_left = LEFT_MARGIN +
+        @graph_left = @left_margin +
                       line_number_width +
                       (@y_axis_label.nil? ? 0.0 : @marker_caps_height + LABEL_MARGIN * 2)
         # Make space for half the width of the rightmost column label.
@@ -499,9 +559,9 @@
         extra_room_for_long_label = (last_label >= (@column_count-1) && @center_labels_over_point) ?
           calculate_width(@marker_font_size, @labels[last_label])/2.0 :
           0
-        @graph_right_margin =   RIGHT_MARGIN + extra_room_for_long_label
+        @graph_right_margin =   @right_margin + extra_room_for_long_label

-        @graph_bottom_margin =  BOTTOM_MARGIN +
+        @graph_bottom_margin =  @bottom_margin +
                                 @marker_caps_height + LABEL_MARGIN
       end

@@ -510,7 +570,7 @@

       # When @hide title, leave a TITLE_MARGIN space for aesthetics.
       # Same with @hide_legend
-      @graph_top = TOP_MARGIN +
+      @graph_top = @top_margin +
                     (@hide_title ? TITLE_MARGIN : @title_caps_height + TITLE_MARGIN * 2) +
                     (@hide_legend ? LEGEND_MARGIN : @legend_caps_height + LEGEND_MARGIN * 2)

@@ -547,7 +607,7 @@
         @d.gravity = CenterGravity
         @d = @d.annotate_scaled( @base_image,
                           1.0, @raw_rows,
-                          LEFT_MARGIN + @marker_caps_height / 2.0, 0.0,
+                          @left_margin + @marker_caps_height / 2.0, 0.0,
                           @y_axis_label, @scale)
         @d.rotation = -90.0
       end
@@ -658,8 +718,8 @@

       current_x_offset = legend_left
       current_y_offset =  @hide_title ?
-                          TOP_MARGIN + LEGEND_MARGIN :
-                          TOP_MARGIN +
+                          @top_margin + LEGEND_MARGIN :
+                          @top_margin +
                           TITLE_MARGIN + @title_caps_height +
                           LEGEND_MARGIN

@@ -706,7 +766,7 @@
       @d.gravity = NorthGravity
       @d = @d.annotate_scaled( @base_image,
                         @raw_columns, 1.0,
-                        0, TOP_MARGIN,
+                        0, @top_margin,
                         @title, @scale)
     end

