Changeset 2

Show
Ignore:
Timestamp:
12/22/05 12:42:44 (5 years ago)
Author:
grig
Message:

Applied patch sent by Mark Kuba:
1) altered the axes sizing. Plot points would be cut off if the
maximum or minimum of a data set was a negative number (line 226)
2) altered the new figure creation call so that multiple calls to
plot_sparkline() do not add plots to the same figure. (line 183)

Added LICENSE (PSF).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sparkplot.py

    r1 r2  
    2727                 draw_hspan=False, hspan_min=-1, hspan_max=0, 
    2828                 label_format="", currency='$', transparency=False, verbose=0): 
     29 
    2930        self.type = type 
    3031        self.data = data 
     
    127128        Plot sparkline graphic by using various matplotlib functions. 
    128129        """ 
     130 
    129131        if len(self.data) == 0: 
    130132            self.data = self.get_input_data() 
     
    179181 
    180182        # Create a figure with the given width, height and dpi 
    181         fig = figure(1, figsize=(fig_width, fig_height), dpi=150) 
     183        fig = figure(figsize=(fig_width, fig_height), dpi=150) 
    182184 
    183185        if self.type.startswith('line'): 
     
    222224        # We leave some space around the data points so that the plot points for 
    223225        # the first/last/min/max points are displayed 
    224         axis([-1, num_points, 0.9*min_data, 1.1*max_data ])                 
     226        axis([-1, num_points, min_data - (abs(min_data)*0.1), max_data + (abs(max_data)*0.1) ])                 
    225227 
    226228        # Turn off all axis display elements (frame, ticks, tick labels) 
     
    286288    sparkplot.process_args() 
    287289    sparkplot.plot_sparkline() 
     290