@@ -2450,26 +2450,25 @@ def get_handles():
24502450
24512451
24522452 def bar (self , left , height , width = 0.8 , bottom = 0 ,
2453- color = None , edgecolor = None , yerr = None , xerr = None , ecolor = None , capsize = 3 ,
2453+ color = None , edgecolor = None , linewidth = None ,
2454+ yerr = None , xerr = None , ecolor = None , capsize = 3 ,
24542455 align = 'edge' , orientation = 'vertical'
24552456 ):
24562457 """
24572458 BAR(left, height, width=0.8, bottom=0,
2458- color=None, edgecolor=None, yerr=None, xerr=None, ecolor=None, capsize=3,
2459+ color=None, edgecolor=None, linewidth=None,
2460+ yerr=None, xerr=None, ecolor=None, capsize=3,
24592461 align='edge', orientation='vertical')
24602462
24612463 Make a bar plot with rectangles bounded by
24622464
2463- left, left+width, bottom, bottom+height (left, right, bottom and top edges)
2465+ left, left+width, bottom, bottom+height
2466+ (left, right, bottom and top edges)
24642467
24652468 left, height, width, and bottom can be either scalars or sequences
24662469
24672470 Return value is a list of Rectangle patch instances
24682471
2469- BAR(left, height, width, bottom,
2470- color, edgecolor, yerr, xerr, ecolor, capsize,
2471- align, orientation)
2472-
24732472 left - the x coordinates of the left sides of the bars
24742473
24752474 height - the heights of the bars
@@ -2480,9 +2479,12 @@ def bar(self, left, height, width=0.8, bottom=0,
24802479
24812480 bottom - the y coordinates of the bottom edges of the bars
24822481
2483- color specifies the colors of the bars
2482+ color - the colors of the bars
24842483
2485- edgecolor specifies the colors of the bar edges
2484+ edgecolor - the colors of the bar edges
2485+
2486+ linewidth - width of bar edges; None means use default
2487+ linewidth; 0 means don't draw edges.
24862488
24872489 xerr and yerr, if not None, will be used to generate errorbars
24882490 on the bar chart
@@ -2496,9 +2498,12 @@ def bar(self, left, height, width=0.8, bottom=0,
24962498 orientation = 'vertical' | 'horizontal'
24972499
24982500 For vertical bars, 'edge' aligns bars by their left edges in left,
2499- while 'center' interprets these values as the x coordinates of the bar centers.
2500- For horizontal bars, 'edge' aligns bars by their bottom edges in bottom,
2501- while 'center' interprets these values as the y coordinates of the bar centers.
2501+ while 'center' interprets these values as the x coordinates
2502+ of the bar centers.
2503+ For horizontal bars, 'edge' aligns bars by their bottom edges
2504+ in bottom,
2505+ while 'center' interprets these values as the y coordinates
2506+ of the bar centers.
25022507
25032508 The optional arguments color, edgecolor, yerr, and xerr can be either
25042509 scalars or sequences of length equal to the number of bars
@@ -2519,6 +2524,7 @@ def make_iterable(x):
25192524 height = make_iterable (height )
25202525 width = make_iterable (width )
25212526 bottom = make_iterable (bottom )
2527+ linewidth = make_iterable (linewidth )
25222528
25232529 if orientation == 'vertical' :
25242530 # size width and bottom according to length of left
@@ -2541,6 +2547,7 @@ def make_iterable(x):
25412547 height = asarray (height )
25422548 width = asarray (width )
25432549 bottom = asarray (bottom )
2550+ if len (linewidth ) == 1 : linewidth = linewidth * nbars
25442551
25452552 # if color looks like a color string, an RGB tuple or a
25462553 # scalar, then repeat it by nbars
@@ -2567,19 +2574,16 @@ def make_iterable(x):
25672574 else :
25682575 xerr = asarray (xerr )
25692576
2570- if orientation == 'vertical' :
2571- lenarg = 'left'
2572- elif orientation == 'horizontal' :
2573- lenarg = 'bottom'
2574- assert len (left )== nbars , 'bar() argument \' left\' must be len(%s) or scalar' % lenarg
2575- assert len (height )== nbars , 'bar() argument \' height\' must be len(%s) or scalar' % lenarg
2576- assert len (width )== nbars , 'bar() argument \' width\' must be len(%s) or scalar' % lenarg
2577- assert len (bottom )== nbars , 'bar() argument \' bottom\' must be len(%s) or scalar' % lenarg
2578- assert len (color )== nbars , 'bar() argument \' color\' must be len(%s) or scalar' % lenarg
2579- assert len (edgecolor )== nbars , 'bar() argument \' edgecolor\' must be len(%s) or scalar' % lenarg
2577+ assert len (left )== nbars , "argument 'left' must be %d or scalar" % nbars
2578+ assert len (height )== nbars , "argument 'height' must be %d or scalar" % nbars
2579+ assert len (width )== nbars , "argument 'width' must be %d or scalar" % nbars
2580+ assert len (bottom )== nbars , "argument 'bottom' must be %d or scalar" % nbars
2581+ assert len (color )== nbars , "argument 'color' must be %d or scalar" % nbars
2582+ assert len (edgecolor )== nbars , "argument 'edgecolor' must be %d or scalar" % nbars
2583+ assert len (linewidth )== nbars , "argument 'linewidth' must be %d or scalar" % nbars
25802584
2581- if yerr is not None : assert len (yerr )== nbars , ' bar() argument \ ' yerr\ ' must be len(%s) or scalar' % lenarg
2582- if xerr is not None : assert len (xerr )== nbars , ' bar() argument \ ' xerr\ ' must be len(%s) or scalar' % lenarg
2585+ if yerr is not None : assert len (yerr )== nbars , " bar() argument 'yerr' must be len(%s) or scalar" % nbars
2586+ if xerr is not None : assert len (xerr )== nbars , " bar() argument 'xerr' must be len(%s) or scalar" % nbars
25832587
25842588 patches = []
25852589
@@ -2593,15 +2597,16 @@ def make_iterable(x):
25932597 else :
25942598 raise ValueError , 'invalid alignment: %s' % align
25952599
2596- args = zip (left , bottom , width , height , color , edgecolor )
2597- for l , b , w , h , c , e in args :
2600+ args = zip (left , bottom , width , height , color , edgecolor , linewidth )
2601+ for l , b , w , h , c , e , lw in args :
25982602 if h < 0 :
25992603 b += h
26002604 h = abs (h )
26012605 r = Rectangle (
26022606 xy = (l , b ), width = w , height = h ,
26032607 facecolor = c ,
26042608 edgecolor = e ,
2609+ linewidth = lw ,
26052610 )
26062611 self .add_patch (r )
26072612 patches .append (r )
@@ -2626,12 +2631,14 @@ def make_iterable(x):
26262631
26272632
26282633 def barh (self , bottom , width , height = 0.8 , left = 0 ,
2629- color = None , edgecolor = None , xerr = None , yerr = None , ecolor = None , capsize = 3 ,
2634+ color = None , edgecolor = None , linewidth = None ,
2635+ xerr = None , yerr = None , ecolor = None , capsize = 3 ,
26302636 align = 'edge'
26312637 ):
26322638 """
26332639 BARH(bottom, width, height=0.8, left=0,
2634- color=None, edgecolor=None, xerr=None, yerr=None, ecolor=None, capsize=3,
2640+ color=None, edgecolor=None, linewidth=None,
2641+ xerr=None, yerr=None, ecolor=None, capsize=3,
26352642 align='edge')
26362643
26372644 Make a horizontal bar plot with rectangles bounded by
@@ -2642,10 +2649,6 @@ def barh(self, bottom, width, height=0.8, left=0,
26422649
26432650 Return value is a list of Rectangle patch instances
26442651
2645- BARH(bottom, width, height, left,
2646- color, edgecolor, xerr, yerr, ecolor, capsize,
2647- align)
2648-
26492652 bottom - the vertical positions of the bottom edges of the bars
26502653
26512654 width - the lengths of the bars
@@ -2671,22 +2674,24 @@ def barh(self, bottom, width, height=0.8, left=0,
26712674 'edge' aligns the horizontal bars by their bottom edges in bottom, while
26722675 'center' interprets these values as the y coordinates of the bar centers.
26732676
2674- The optional arguments color, edgecolor, xerr, and yerr can be either
2677+ The optional arguments color, edgecolor, linewidth,
2678+ xerr, and yerr can be either
26752679 scalars or sequences of length equal to the number of bars
26762680
26772681 This enables you to use barh as the basis for stacked bar
26782682 charts, or candlestick plots
26792683 """
26802684
26812685 patches = self .bar (left = left , height = height , width = width , bottom = bottom ,
2682- color = color , edgecolor = edgecolor , yerr = yerr , xerr = xerr , ecolor = ecolor , capsize = capsize ,
2686+ color = color , edgecolor = edgecolor , linewidth = linewidth ,
2687+ yerr = yerr , xerr = xerr , ecolor = ecolor , capsize = capsize ,
26832688 align = align , orientation = 'horizontal'
26842689 )
26852690 return patches
26862691
26872692 def broken_barh (self , xranges , yrange , ** kwargs ):
26882693 """
2689- A colleciton of horizontal bars spanning yrange with a sequence of
2694+ A collection of horizontal bars spanning yrange with a sequence of
26902695 xranges
26912696
26922697 xranges : sequence of (xmin, xwidth)
0 commit comments