ppinard/matplotlib-scalebar

Draw the scalebar without any text

pskeshu opened this issue · 6 comments

I'm trying to plot just a scalebar without any associated text that says what's the length and unit of scale bar. What's the best way to do this?

Thanks @AKuederle! 😃

Although I had to use label_formatter = lambda x, y:''. I was previously trying scalebar.label_formatter('', '') which didn't work as expected.

habi commented

One thing that worked for me was setting the label text to size zero with font_properties={'size':0}.

Setting font_properties={'size':0} adds a tiny scalebar text, as can be seen in the heavily zoomed screenshot below. Use label_formatter = lambda x, y:'' as suggested by @pskeshu above!

Clipboard01

Thanks for the information.
As of 2022, scale_formatter=lambda x, y:'' works for this because 'label_formatter' is deprecated.

Actually as of 2022, it is easier to do set scale_loc and label_loc to "none". Note not None, but a string none.