Commit 5370854f authored by Kris Vanneste's avatar Kris Vanneste
Browse files

Improved draw_scalebar method of LayeredBasemap.

Improved some docstrings.

git-svn-id: https://svn.seismo.oma.be/svn/seismo/mapping/layeredbasemap/trunk@7654 40b490c5-b4d9-47cb-8714-9bef99b524d5
parent c5d7d19a
......@@ -2072,7 +2072,7 @@ class LayeredBasemap:
def draw_graticule(self):
"""
Draw meridians and parallels
Draw meridians and parallels according to :prop:`graticule_style`
"""
# TODO: find a way to plot only ticks and/or parallel/meridian intersections
if self.graticule_style:
......@@ -2101,6 +2101,9 @@ class LayeredBasemap:
self.zorder += 1
def draw_scalebar(self):
"""
Draw scalebar according to :prop:`scalebar_style`
"""
if self.scalebar_style:
scalebar_style = self.scalebar_style.copy()
lon0, lat0 = self.lon_0, self.lat_0
......@@ -2135,11 +2138,24 @@ class LayeredBasemap:
scale[-3].set_text(scalebar_style.length / 2)
scale[-2].set_text(scalebar_style.length)
## Draw opaque box around text elements to hide map elements below
for el in scale:
bg_color = 'w'
if self.border_style:
bg_color = self.border_style.fill_color
if isinstance(el, matplotlib.text.Text):
el.set_bbox(dict(facecolor=bg_color, edgecolor='None', alpha=1,
boxstyle= "Square, pad=0.1"))
def draw_map_border(self):
"""
Draw map border according to :prop:`border_style`
"""
if self.border_style:
## Note: zorder left to default
## High zorder values don't work with global projections
self.map.drawmapboundary(zorder=None, ax=self.ax, **self.border_style.to_kwargs())
self.map.drawmapboundary(zorder=None, ax=self.ax,
**self.border_style.to_kwargs())
def draw(self):
## Note: We call draw_map_border twice, once at the beginning
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment