0

This is a very easy question for you to answer, I'm sure. I am using bqplot (with pyplot) and by default, the legend is framed. So my question is: how do I remove the frame? With matplotlib, I know that I can simply use plt.legend(frameon=False), do you know a direct equivalent for bqplot?

The piece of code looks like this:

import bqplot.pyplot as pl

plot_test = pl.figure()
test = pl.plot(x,y, colors = ["white"],labels=['blabla'])
pl.legend()
pl.show()

Thank you in advance!

Leinahtan
  • 57
  • 1
  • 5

1 Answers1

1

The easiest way to remove the border is to change the legend border width to 0.

plot_test.legend_style = {'stroke-width': 0}

enter image description here

Bqplot legend styling uses SVG CSS styling properties. Other legend styling examples include.....

plot_test.legend_style = {
    'fill': 'white'  ,
    'stroke' : 'blue' ,
    'stroke-width':3,
    'opacity':0.7   
                  }
DougR
  • 3,196
  • 1
  • 28
  • 29
  • Thank you very much! It worked as expected. On a related note, it happens very often that I want to modify a single parameter in a plot (color, thickness, or else), but usually I end up googling and checking if someone has already asked the same question. Looking at the bqplot documentation, it was not obvious to me which format I should adopt when I want to modify something, as it seems to vary from property to property. Any tip on how to proceed, when one wants to modify a property which he has never used before? – Leinahtan Sep 27 '19 at 09:50