alexras/boomslang — Issue #13: Support for changing the font size of Labels
Author: alexras
Created: 2012-02-16 20:49:56+00:00
State: open

From Jan Ellenbeck:

> Hi Alex,
>
> maybe this time I just did not figure out how it works. But I added support for changing the font size of Labels.
>
> It works this way, but maybe it was working anyway or maybe there are nicer ways to do this…
>
> Cheers
> Jan
>
> diff -r 9b467bb55fd6 Label.py
> --- a/Label.py Thu Dec 01 12:41:41 2011 -0800
> +++ b/Label.py Sun Dec 04 05:10:21 2011 +0100
> @@ -4,7 +4,7 @@
> from Marker import Marker
>
> class Label(PlotInfo):
> - def __init__(self, x, y, text=None, bbox=None):
> + def __init__(self, x, y, text=None, bbox=None, textSize = None):
> PlotInfo.__init__(self, "label")
>
> self.x = x
> @@ -15,6 +15,7 @@
> self.arrow = None
> self._marker = Marker()
> self.rotation = None
> + self.textSize = textSize
>
> if bbox: self.bbox = dict(bbox)
> else: self.bbox = None
> @@ -50,6 +51,8 @@
> kwdict["arrowprops"] = self.arrow
> kwdict["horizontalalignment"] = "center"
> kwdict["rotation"] = self.rotation
> + if self.textSize is not None:
> + kwdict["size"] = self.textSize
>
> # For props, see
> # http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.Rectangle
>