results: leave some margin in the y-axis to help visualize the data
diff --git a/cr2/results.py b/cr2/results.py
index ed12c7c..a7ec48b 100644
--- a/cr2/results.py
+++ b/cr2/results.py
@@ -11,6 +11,40 @@
 
 class CR2(pd.DataFrame):
     """A DataFrame-like class for storing benchmark results"""
+    def __init__(self, *args, **kwargs):
+        super(CR2, self).__init__(*args, **kwargs)
+        self.ax = None
+
+    def init_fig(self):
+        _, self.ax = plt.subplots()
+
+    def enlarge_axis(self, data):
+        """Make sure that the axis don't clobber some of the data"""
+
+        (_, _, plot_y_min, plot_y_max) = plt.axis()
+
+        concat_data = pd.concat(data[s] for s in data)
+        data_min = min(concat_data)
+        data_max = max(concat_data)
+
+        # A good margin can be 10% of the data range
+        margin = (data_max - data_min) / 10
+        if margin < 1:
+            margin = 1
+
+        update_axis = False
+
+        if data_min <= plot_y_min:
+            plot_y_min = data_min - margin
+            update_axis = True
+
+        if data_max >= plot_y_max:
+            plot_y_max = data_max + margin
+            update_axis = True
+
+        if update_axis:
+            self.ax.set_ylim(plot_y_min, plot_y_max)
+
     def plot_results_benchmark(self, benchmark, title=None):
         """Plot the results of the execution of a given benchmark
 
@@ -21,8 +55,10 @@
             title = benchmark.replace('_', ' ')
             title = title.title()
 
-        self[benchmark].plot()
+        self.init_fig()
+        self[benchmark].plot(ax=self.ax)
         plt.title(title)
+        self.enlarge_axis(self[benchmark])
 
     def plot_results(self):
         for bench in self.columns.levels[0]:
diff --git a/tests/test_results.py b/tests/test_results.py
index 0bda9c4..c2718e8 100644
--- a/tests/test_results.py
+++ b/tests/test_results.py
@@ -2,6 +2,7 @@
 
 import os, sys
 import tempfile
+import pandas as pd
 
 import utils_tests
 sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "cr2"))
@@ -53,10 +54,26 @@
 
         Can't test it, so just check that it doens't bomb
         """
-        results_frame = results.get_results()
+        from matplotlib import pyplot as plt
 
-        results_frame.plot_results_benchmark("antutu")
-        results_frame.plot_results_benchmark("glbench_trex", title="Glbench TRex")
+        r1 = results.get_results()
+        r2 = results.get_results()
+        r2["glbench_trex"].loc[1] = 28
+        r2["glbench_trex"].loc[2] = 28
+        combined = results.combine_results([r1, r2], ["r1", "r2"])
+
+        combined.plot_results_benchmark("antutu")
+        combined.plot_results_benchmark("glbench_trex", title="Glbench TRex")
+
+        (_, _, y_min, y_max) = plt.axis()
+
+        concat_data = pd.concat(combined["glbench_trex"][s] for s in combined["glbench_trex"])
+        data_min = min(concat_data)
+        data_max = max(concat_data)
+
+        # Fail if the axes are within the limits of the data.
+        self.assertTrue(data_min > y_min)
+        self.assertTrue(data_max < y_max)
 
     def test_get_run_number(self):
         self.assertEquals(results.get_run_number("score_2"), (True, 2))
@@ -76,3 +93,7 @@
         combined = results.combine_results([r1, r2], ["r1", "r2"])
 
         combined.plot_results()
+
+    def test_init_fig(self):
+        r1 = results.get_results()
+        r1.init_fig()