Skip to content
This repository

Add framealpha argument for legend #1626

Merged
merged 2 commits into from over 1 year ago

5 participants

Piti Ongmongkolkul Damon McDougall Michael Droettboom Phil Elson Benjamin Root
Piti Ongmongkolkul

Straight from matplotlib recipe. I think frame alpha belongs to keyword argument like

ax.legend(framealpha=0.5)

rather than

leg = ax.legend()
leg.get_frame().set_alpha(0.5)
Damon McDougall
Collaborator

Travis failure looks like a dud.

This seems like a simple enough wrapper around .get_frame().set_alpha(). I'd be happy for this to be merged.

Anybody else want to give a +1 or other feedback?

Edit: Barring minor style issues below.

lib/matplotlib/tests/test_legend.py
... ...
@@ -46,3 +46,10 @@ def test_fancy():
46 46
     plt.errorbar(range(10), range(10), xerr=0.5, yerr=0.5, label='XX')
47 47
     plt.legend(loc="center left", bbox_to_anchor=[1.0, 0.5],
48 48
                ncol=2, shadow=True, title="My legend", numpoints=1)
  49
+
  50
+@image_comparison(baseline_images=['framealpha'], remove_text=True)
  51
+def test_framealpha():
  52
+    x = np.linspace(1,100,100)
  53
+    y = x
  54
+    plt.plot(x,y, label='mylabel', lw=10)
1
Damon McDougall Collaborator

Could you add a space after the first comma? Like so: plt.plot(x, y, label='mylabel', lw=10).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
lib/matplotlib/legend.py
... ...
@@ -167,6 +167,9 @@ def __init__(self, parent, handles, labels,
167 167
                                  # box, none use rc
168 168
                  shadow=None,
169 169
                  title=None,  # set a title for the legend
  170
+
  171
+                 framealpha=None, #set frame alpha
1
Damon McDougall Collaborator

Another PEP8 issue: Add an extra space before and after the #.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Michael Droettboom
Owner

Seems fine -- perhaps it's a needless proliferation of keyword arguments -- OTOH, I can see why this is a common thing someone would want to do. @pelson: do you want to ring in on this?

Piti Ongmongkolkul

Both ways to get transparency doesn't work well with shadow though since shadow option assume full opacity of the legend frame.

Michael Droettboom
Owner

Hmmm... should we fix shadow while we're at it, then?

Piti Ongmongkolkul

This is what it looks like. It looks funny but I'm not sure what I should expect....
tmp

plot(range(10),range(10),label='hey')
legend(shadow=True).get_frame().set_alpha(0.5)
Phil Elson
Collaborator

@pelson: do you want to ring in on this?

No complaints from me.

Michael Droettboom
Owner

I think the shadow issue is probably fine for now... I agree -- it's not clear what it should do instead. @piti118: can you please rebase this on master so we can hit that big green merge button?

Benjamin Root
Collaborator
Piti Ongmongkolkul

Rebased.. I think I did it right.

Michael Droettboom
Owner

Yep. Looks good. Merging.

Michael Droettboom mdboom merged commit a53a6f7 into from January 17, 2013
Michael Droettboom mdboom closed this January 17, 2013
Piti Ongmongkolkul

Hmmm... I think I didn't write the change log...

Piti Ongmongkolkul piti118 referenced this pull request from a commit in piti118/matplotlib January 17, 2013
Piti Ongmongkolkul add changelog for #1626 88554a6
Michael Droettboom
Owner

Oh, thanks. I should have noticed it before merging. I should be able to merge that manually. No worries.

Piti Ongmongkolkul

just pull #1677

Michael Droettboom mdboom referenced this pull request from a commit January 17, 2013
Piti Ongmongkolkul add changelog for #1626 a6af0b2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Jan 17, 2013
Piti Ongmongkolkul add framealpha argument for legend 398e7b5
Piti Ongmongkolkul fix PEP8 e92ddea
This page is out of date. Refresh to see the latest.
2  examples/pylab_examples/legend_auto.py
@@ -18,7 +18,7 @@ def fig_1():
18 18
     figure(1)
19 19
     t = arange(0, 40.0 * pi, 0.1)
20 20
     l, = plot(t, 100*sin(t), 'r', label='sine')
21  
-    legend()
  21
+    legend(framealpha=0.5)
22 22
 
23 23
 def fig_2():
24 24
     figure(2)
3  lib/matplotlib/axes.py
@@ -4448,6 +4448,9 @@ def legend(self, *args, **kwargs):
4448 4448
             If *True*, draw a shadow behind legend. If *None*,
4449 4449
             use rc settings.
4450 4450
 
  4451
+          *framealpha*: [*None* | float]
  4452
+            If not None, alpha channel for legend frame. Default *None*.
  4453
+        
4451 4454
           *ncol* : integer
4452 4455
             number of columns. default is 1
4453 4456
 
7  lib/matplotlib/legend.py
@@ -167,6 +167,9 @@ def __init__(self, parent, handles, labels,
167 167
                                  # box, none use rc
168 168
                  shadow=None,
169 169
                  title=None,  # set a title for the legend
  170
+
  171
+                 framealpha=None, # set frame alpha
  172
+
170 173
                  bbox_to_anchor=None,  # bbox that the legend will be anchored.
171 174
                  bbox_transform=None,  # transform for the bbox
172 175
                  frameon=None,  # draw frame
@@ -195,6 +198,7 @@ def __init__(self, parent, handles, labels,
195 198
         fancybox           if True, draw a frame with a round fancybox.
196 199
                            If None, use rc
197 200
         shadow             if True, draw a shadow behind legend
  201
+        framealpha         If not None, alpha channel for the frame.
198 202
         ncol               number of columns
199 203
         borderpad          the fractional whitespace inside the legend border
200 204
         labelspacing       the vertical space between the legend entries
@@ -384,6 +388,9 @@ def __init__(self, parent, handles, labels,
384 388
         # init with null renderer
385 389
         self._init_legend_box(handles, labels)
386 390
 
  391
+        if framealpha is not None:
  392
+          self.get_frame().set_alpha(framealpha)
  393
+
387 394
         self._loc = loc
388 395
 
389 396
         self.set_title(title)
BIN  lib/matplotlib/tests/baseline_images/test_legend/framealpha.pdf
Binary file not shown
BIN  lib/matplotlib/tests/baseline_images/test_legend/framealpha.png
495  lib/matplotlib/tests/baseline_images/test_legend/framealpha.svg
... ...
@@ -0,0 +1,495 @@
  1
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
  2
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  3
+  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
  4
+<!-- Created with matplotlib (http://matplotlib.org/) -->
  5
+<svg height="432pt" version="1.1" viewBox="0 0 576 432" width="576pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  6
+ <defs>
  7
+  <style type="text/css">
  8
+*{stroke-linecap:square;stroke-linejoin:round;}
  9
+  </style>
  10
+ </defs>
  11
+ <g id="figure_1">
  12
+  <g id="patch_1">
  13
+   <path d="
  14
+M0 432
  15
+L576 432
  16
+L576 0
  17
+L0 0
  18
+z
  19
+" style="fill:#ffffff;"/>
  20
+  </g>
  21
+  <g id="axes_1">
  22
+   <g id="patch_2">
  23
+    <path d="
  24
+M72 388.8
  25
+L518.4 388.8
  26
+L518.4 43.2
  27
+L72 43.2
  28
+z
  29
+" style="fill:#ffffff;"/>
  30
+   </g>
  31
+   <g id="line2d_1">
  32
+    <path clip-path="url(#p7ff5b81e1d)" d="
  33
+M76.464 385.344
  34
+L80.928 381.888
  35
+L85.392 378.432
  36
+L89.856 374.976
  37
+L94.32 371.52
  38
+L98.784 368.064
  39
+L103.248 364.608
  40
+L107.712 361.152
  41
+L112.176 357.696
  42
+L116.64 354.24
  43
+L121.104 350.784
  44
+L125.568 347.328
  45
+L130.032 343.872
  46
+L134.496 340.416
  47
+L138.96 336.96
  48
+L143.424 333.504
  49
+L147.888 330.048
  50
+L152.352 326.592
  51
+L156.816 323.136
  52
+L161.28 319.68
  53
+L165.744 316.224
  54
+L170.208 312.768
  55
+L174.672 309.312
  56
+L179.136 305.856
  57
+L183.6 302.4
  58
+L188.064 298.944
  59
+L192.528 295.488
  60
+L196.992 292.032
  61
+L201.456 288.576
  62
+L205.92 285.12
  63
+L210.384 281.664
  64
+L214.848 278.208
  65
+L219.312 274.752
  66
+L223.776 271.296
  67
+L228.24 267.84
  68
+L232.704 264.384
  69
+L237.168 260.928
  70
+L241.632 257.472
  71
+L246.096 254.016
  72
+L250.56 250.56
  73
+L255.024 247.104
  74
+L259.488 243.648
  75
+L263.952 240.192
  76
+L268.416 236.736
  77
+L272.88 233.28
  78
+L277.344 229.824
  79
+L281.808 226.368
  80
+L286.272 222.912
  81
+L290.736 219.456
  82
+L295.2 216
  83
+L299.664 212.544
  84
+L304.128 209.088
  85
+L308.592 205.632
  86
+L313.056 202.176
  87
+L317.52 198.72
  88
+L321.984 195.264
  89
+L326.448 191.808
  90
+L330.912 188.352
  91
+L335.376 184.896
  92
+L339.84 181.44
  93
+L344.304 177.984
  94
+L348.768 174.528
  95
+L353.232 171.072
  96
+L357.696 167.616
  97
+L362.16 164.16
  98
+L366.624 160.704
  99
+L371.088 157.248
  100
+L375.552 153.792
  101
+L380.016 150.336
  102
+L384.48 146.88
  103
+L388.944 143.424
  104
+L393.408 139.968
  105
+L397.872 136.512
  106
+L402.336 133.056
  107
+L406.8 129.6
  108
+L411.264 126.144
  109
+L415.728 122.688
  110
+L420.192 119.232
  111
+L424.656 115.776
  112
+L429.12 112.32
  113
+L433.584 108.864
  114
+L438.048 105.408
  115
+L442.512 101.952
  116
+L446.976 98.496
  117
+L451.44 95.04
  118
+L455.904 91.584
  119
+L460.368 88.128
  120
+L464.832 84.672
  121
+L469.296 81.216
  122
+L473.76 77.76
  123
+L478.224 74.304
  124
+L482.688 70.848
  125
+L487.152 67.392
  126
+L491.616 63.936
  127
+L496.08 60.48
  128
+L500.544 57.024
  129
+L505.008 53.568
  130
+L509.472 50.112
  131
+L513.936 46.656
  132
+L518.4 43.2" style="fill:none;stroke:#0000ff;stroke-width:10;"/>
  133
+   </g>
  134
+   <g id="matplotlib.axis_1">
  135
+    <g id="xtick_1">
  136
+     <g id="line2d_2">
  137
+      <defs>
  138
+       <path d="
  139
+M0 0
  140
+L0 -4" id="mcb557df647" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
  141
+      </defs>
  142
+      <g>
  143
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mcb557df647" y="388.8"/>
  144
+      </g>
  145
+     </g>
  146
+     <g id="line2d_3">
  147
+      <defs>
  148
+       <path d="
  149
+M0 0
  150
+L0 4" id="mdad270ee8e" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
  151
+      </defs>
  152
+      <g>
  153
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mdad270ee8e" y="43.2"/>
  154
+      </g>
  155
+     </g>
  156
+    </g>
  157
+    <g id="xtick_2">
  158
+     <g id="line2d_4">
  159
+      <g>
  160
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="161.28" xlink:href="#mcb557df647" y="388.8"/>
  161
+      </g>
  162
+     </g>
  163
+     <g id="line2d_5">
  164
+      <g>
  165
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="161.28" xlink:href="#mdad270ee8e" y="43.2"/>
  166
+      </g>
  167
+     </g>
  168
+    </g>
  169
+    <g id="xtick_3">
  170
+     <g id="line2d_6">
  171
+      <g>
  172
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="250.56" xlink:href="#mcb557df647" y="388.8"/>
  173
+      </g>
  174
+     </g>
  175
+     <g id="line2d_7">
  176
+      <g>
  177
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="250.56" xlink:href="#mdad270ee8e" y="43.2"/>
  178
+      </g>
  179
+     </g>
  180
+    </g>
  181
+    <g id="xtick_4">
  182
+     <g id="line2d_8">
  183
+      <g>
  184
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="339.84" xlink:href="#mcb557df647" y="388.8"/>
  185
+      </g>
  186
+     </g>
  187
+     <g id="line2d_9">
  188
+      <g>
  189
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="339.84" xlink:href="#mdad270ee8e" y="43.2"/>
  190
+      </g>
  191
+     </g>
  192
+    </g>
  193
+    <g id="xtick_5">
  194
+     <g id="line2d_10">
  195
+      <g>
  196
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="429.12" xlink:href="#mcb557df647" y="388.8"/>
  197
+      </g>
  198
+     </g>
  199
+     <g id="line2d_11">
  200
+      <g>
  201
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="429.12" xlink:href="#mdad270ee8e" y="43.2"/>
  202
+      </g>
  203
+     </g>
  204
+    </g>
  205
+    <g id="xtick_6">
  206
+     <g id="line2d_12">
  207
+      <g>
  208
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#mcb557df647" y="388.8"/>
  209
+      </g>
  210
+     </g>
  211
+     <g id="line2d_13">
  212
+      <g>
  213
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#mdad270ee8e" y="43.2"/>
  214
+      </g>
  215
+     </g>
  216
+    </g>
  217
+   </g>
  218
+   <g id="matplotlib.axis_2">
  219
+    <g id="ytick_1">
  220
+     <g id="line2d_14">
  221
+      <defs>
  222
+       <path d="
  223
+M0 0
  224
+L4 0" id="mc8fcea1516" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
  225
+      </defs>
  226
+      <g>
  227
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="388.8"/>
  228
+      </g>
  229
+     </g>
  230
+     <g id="line2d_15">
  231
+      <defs>
  232
+       <path d="
  233
+M0 0
  234
+L-4 0" id="m0d5b0a6425" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
  235
+      </defs>
  236
+      <g>
  237
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="388.8"/>
  238
+      </g>
  239
+     </g>
  240
+    </g>
  241
+    <g id="ytick_2">
  242
+     <g id="line2d_16">
  243
+      <g>
  244
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="319.68"/>
  245
+      </g>
  246
+     </g>
  247
+     <g id="line2d_17">
  248
+      <g>
  249
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="319.68"/>
  250
+      </g>
  251
+     </g>
  252
+    </g>
  253
+    <g id="ytick_3">
  254
+     <g id="line2d_18">
  255
+      <g>
  256
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="250.56"/>
  257
+      </g>
  258
+     </g>
  259
+     <g id="line2d_19">
  260
+      <g>
  261
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="250.56"/>
  262
+      </g>
  263
+     </g>
  264
+    </g>
  265
+    <g id="ytick_4">
  266
+     <g id="line2d_20">
  267
+      <g>
  268
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="181.44"/>
  269
+      </g>
  270
+     </g>
  271
+     <g id="line2d_21">
  272
+      <g>
  273
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="181.44"/>
  274
+      </g>
  275
+     </g>
  276
+    </g>
  277
+    <g id="ytick_5">
  278
+     <g id="line2d_22">
  279
+      <g>
  280
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="112.32"/>
  281
+      </g>
  282
+     </g>
  283
+     <g id="line2d_23">
  284
+      <g>
  285
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="112.32"/>
  286
+      </g>
  287
+     </g>
  288
+    </g>
  289
+    <g id="ytick_6">
  290
+     <g id="line2d_24">
  291
+      <g>
  292
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="43.2"/>
  293
+      </g>
  294
+     </g>
  295
+     <g id="line2d_25">
  296
+      <g>
  297
+       <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="43.2"/>
  298
+      </g>
  299
+     </g>
  300
+    </g>
  301
+   </g>
  302
+   <g id="patch_3">
  303
+    <path d="
  304
+M72 43.2
  305
+L518.4 43.2" style="fill:none;stroke:#000000;"/>
  306
+   </g>
  307
+   <g id="patch_4">
  308
+    <path d="
  309
+M518.4 388.8
  310
+L518.4 43.2" style="fill:none;stroke:#000000;"/>
  311
+   </g>
  312
+   <g id="patch_5">
  313
+    <path d="
  314
+M72 388.8
  315
+L518.4 388.8" style="fill:none;stroke:#000000;"/>
  316
+   </g>
  317
+   <g id="patch_6">
  318
+    <path d="
  319
+M72 388.8
  320
+L72 43.2" style="fill:none;stroke:#000000;"/>
  321
+   </g>
  322
+   <g id="legend_1">
  323
+    <g id="patch_7">
  324
+     <path d="
  325
+M404.735 75.8565
  326
+L511.2 75.8565
  327
+L511.2 50.4
  328
+L404.735 50.4
  329
+L404.735 75.8565
  330
+z
  331
+" style="fill:#ffffff;opacity:0.5;stroke:#000000;"/>
  332
+    </g>
  333
+    <g id="line2d_26">
  334
+     <path d="
  335
+M414.815 62.0617
  336
+L434.975 62.0617" style="fill:none;stroke:#0000ff;stroke-width:10;"/>
  337
+    </g>
  338
+    <g id="line2d_27"/>
  339
+    <g id="text_1">
  340
+     <!-- mylabel -->
  341
+     <defs>
  342
+      <path d="
  343
+M52 44.1875
  344
+Q55.375 50.25 60.0625 53.125
  345
+Q64.75 56 71.0938 56
  346
+Q79.6406 56 84.2812 50.0156
  347
+Q88.9219 44.0469 88.9219 33.0156
  348
+L88.9219 0
  349
+L79.8906 0
  350
+L79.8906 32.7188
  351
+Q79.8906 40.5781 77.0938 44.375
  352
+Q74.3125 48.1875 68.6094 48.1875
  353
+Q61.625 48.1875 57.5625 43.5469
  354
+Q53.5156 38.9219 53.5156 30.9062
  355
+L53.5156 0
  356
+L44.4844 0
  357
+L44.4844 32.7188
  358
+Q44.4844 40.625 41.7031 44.4062
  359
+Q38.9219 48.1875 33.1094 48.1875
  360
+Q26.2188 48.1875 22.1562 43.5312
  361
+Q18.1094 38.875 18.1094 30.9062
  362
+L18.1094 0
  363
+L9.07812 0
  364
+L9.07812 54.6875
  365
+L18.1094 54.6875
  366
+L18.1094 46.1875
  367
+Q21.1875 51.2188 25.4844 53.6094
  368
+Q29.7812 56 35.6875 56
  369
+Q41.6562 56 45.8281 52.9688
  370
+Q50 49.9531 52 44.1875" id="BitstreamVeraSans-Roman-6d"/>
  371
+      <path d="
  372
+M9.42188 75.9844
  373
+L18.4062 75.9844
  374
+L18.4062 0
  375
+L9.42188 0
  376
+z
  377
+" id="BitstreamVeraSans-Roman-6c"/>
  378
+      <path d="
  379
+M32.1719 -5.07812
  380
+Q28.375 -14.8438 24.75 -17.8125
  381
+Q21.1406 -20.7969 15.0938 -20.7969
  382
+L7.90625 -20.7969
  383
+L7.90625 -13.2812
  384
+L13.1875 -13.2812
  385
+Q16.8906 -13.2812 18.9375 -11.5156
  386
+Q21 -9.76562 23.4844 -3.21875
  387
+L25.0938 0.875
  388
+L2.98438 54.6875
  389
+L12.5 54.6875
  390
+L29.5938 11.9219
  391
+L46.6875 54.6875
  392
+L56.2031 54.6875
  393
+z
  394
+" id="BitstreamVeraSans-Roman-79"/>
  395
+      <path d="
  396
+M56.2031 29.5938
  397
+L56.2031 25.2031
  398
+L14.8906 25.2031
  399
+Q15.4844 15.9219 20.4844 11.0625
  400
+Q25.4844 6.20312 34.4219 6.20312
  401
+Q39.5938 6.20312 44.4531 7.46875
  402
+Q49.3125 8.73438 54.1094 11.2812
  403
+L54.1094 2.78125
  404
+Q49.2656 0.734375 44.1875 -0.34375
  405
+Q39.1094 -1.42188 33.8906 -1.42188
  406
+Q20.7969 -1.42188 13.1562 6.1875
  407
+Q5.51562 13.8125 5.51562 26.8125
  408
+Q5.51562 40.2344 12.7656 48.1094
  409
+Q20.0156 56 32.3281 56
  410
+Q43.3594 56 49.7812 48.8906
  411
+Q56.2031 41.7969 56.2031 29.5938
  412
+M47.2188 32.2344
  413
+Q47.125 39.5938 43.0938 43.9844
  414
+Q39.0625 48.3906 32.4219 48.3906
  415
+Q24.9062 48.3906 20.3906 44.1406
  416
+Q15.875 39.8906 15.1875 32.1719
  417
+z
  418
+" id="BitstreamVeraSans-Roman-65"/>
  419
+      <path d="
  420
+M34.2812 27.4844
  421
+Q23.3906 27.4844 19.1875 25
  422
+Q14.9844 22.5156 14.9844 16.5
  423
+Q14.9844 11.7188 18.1406 8.90625
  424
+Q21.2969 6.10938 26.7031 6.10938
  425
+Q34.1875 6.10938 38.7031 11.4062
  426
+Q43.2188 16.7031 43.2188 25.4844
  427
+L43.2188 27.4844
  428
+z
  429
+
  430
+M52.2031 31.2031
  431
+L52.2031 0
  432
+L43.2188 0
  433
+L43.2188 8.29688
  434
+Q40.1406 3.32812 35.5469 0.953125
  435
+Q30.9531 -1.42188 24.3125 -1.42188
  436
+Q15.9219 -1.42188 10.9531 3.29688
  437
+Q6 8.01562 6 15.9219
  438
+Q6 25.1406 12.1719 29.8281
  439
+Q18.3594 34.5156 30.6094 34.5156
  440
+L43.2188 34.5156
  441
+L43.2188 35.4062
  442
+Q43.2188 41.6094 39.1406 45
  443
+Q35.0625 48.3906 27.6875 48.3906
  444
+Q23 48.3906 18.5469 47.2656
  445
+Q14.1094 46.1406 10.0156 43.8906
  446
+L10.0156 52.2031
  447
+Q14.9375 54.1094 19.5781 55.0469
  448
+Q24.2188 56 28.6094 56
  449
+Q40.4844 56 46.3438 49.8438
  450
+Q52.2031 43.7031 52.2031 31.2031" id="BitstreamVeraSans-Roman-61"/>
  451
+      <path d="
  452
+M48.6875 27.2969
  453
+Q48.6875 37.2031 44.6094 42.8438
  454
+Q40.5312 48.4844 33.4062 48.4844
  455
+Q26.2656 48.4844 22.1875 42.8438
  456
+Q18.1094 37.2031 18.1094 27.2969
  457
+Q18.1094 17.3906 22.1875 11.75
  458
+Q26.2656 6.10938 33.4062 6.10938
  459
+Q40.5312 6.10938 44.6094 11.75
  460
+Q48.6875 17.3906 48.6875 27.2969
  461
+M18.1094 46.3906
  462
+Q20.9531 51.2656 25.2656 53.625
  463
+Q29.5938 56 35.5938 56
  464
+Q45.5625 56 51.7812 48.0938
  465
+Q58.0156 40.1875 58.0156 27.2969
  466
+Q58.0156 14.4062 51.7812 6.48438
  467
+Q45.5625 -1.42188 35.5938 -1.42188
  468
+Q29.5938 -1.42188 25.2656 0.953125
  469
+Q20.9531 3.32812 18.1094 8.20312
  470
+L18.1094 0
  471
+L9.07812 0
  472
+L9.07812 75.9844
  473
+L18.1094 75.9844
  474
+z
  475
+" id="BitstreamVeraSans-Roman-62"/>
  476
+     </defs>
  477
+     <g transform="translate(450.815 67.10175)scale(0.144 -0.144)">
  478
+      <use xlink:href="#BitstreamVeraSans-Roman-6d"/>
  479
+      <use x="97.412109375" xlink:href="#BitstreamVeraSans-Roman-79"/>
  480
+      <use x="156.591796875" xlink:href="#BitstreamVeraSans-Roman-6c"/>
  481
+      <use x="184.375" xlink:href="#BitstreamVeraSans-Roman-61"/>
  482
+      <use x="245.654296875" xlink:href="#BitstreamVeraSans-Roman-62"/>
  483
+      <use x="309.130859375" xlink:href="#BitstreamVeraSans-Roman-65"/>
  484
+      <use x="370.654296875" xlink:href="#BitstreamVeraSans-Roman-6c"/>
  485
+     </g>
  486
+    </g>
  487
+   </g>
  488
+  </g>
  489
+ </g>
  490
+ <defs>
  491
+  <clipPath id="p7ff5b81e1d">
  492
+   <rect height="345.6" width="446.4" x="72.0" y="43.2"/>
  493
+  </clipPath>
  494
+ </defs>
  495
+</svg>
6  lib/matplotlib/tests/test_legend.py
@@ -47,6 +47,12 @@ def test_fancy():
47 47
     plt.legend(loc="center left", bbox_to_anchor=[1.0, 0.5],
48 48
                ncol=2, shadow=True, title="My legend", numpoints=1)
49 49
 
  50
+@image_comparison(baseline_images=['framealpha'], remove_text=True)
  51
+def test_framealpha():
  52
+    x = np.linspace(1, 100, 100)
  53
+    y = x
  54
+    plt.plot(x, y, label='mylabel', lw=10)
  55
+    plt.legend(framealpha=0.5)
50 56
     
51 57
 @image_comparison(baseline_images=['scatter_rc3','scatter_rc1'], remove_text=True)
52 58
 def test_rc():
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.