Skip to content

Commit d07f990

Browse files
committed
FIX: passing keyword arguments to Borehole.legend
1 parent c90976b commit d07f990

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

pygimli/frameworks/methodManager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,7 @@ def applyMesh(self, mesh, ignoreRegionManager=False, **kwargs):
770770
self.fop.setMesh(mesh, ignoreRegionManager=ignoreRegionManager)
771771

772772

773-
def invert(self, data=None, mesh=None, startModel=None,
774-
**kwargs):
773+
def invert(self, data=None, mesh=None, startModel=None, **kwargs):
775774
"""Run the full inversion.
776775
777776
Parameters

pygimli/viewer/mpl/boreholes.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,26 +148,47 @@ def _build_common_colormap(self):
148148
self.cmin = min(self.class_id)
149149
self.cmax = max(self.class_id)
150150

151-
def plot(self, ax, plot_thickness=1.0, do_legend=True, **legend_kwargs):
152-
"""Plot the boreholes on the specified axis."""
151+
def plot(self, ax, plot_thickness=1.0, do_legend=True, **kwargs):
152+
"""Plot the boreholes on the specified axis.
153+
154+
Parameters
155+
----------
156+
ax : matplotlib.Axes
157+
plot_thickness : float [1.0]
158+
width (in m) for borehole columns
159+
do_legend : bool
160+
draw a legend for the geological units
161+
**kwargs : keyword arguments passed to legend
162+
fontsize, markerscale, (s. matplotlib.legend)
163+
"""
153164
self._build_common_colormap()
154165

155166
for b in self.boreholes:
156167
b.plot(ax, plot_thickness=plot_thickness, do_legend=False,
157168
cmin=self.cmin, cmax=self.cmax, cm=self.cm)
158169

159170
if do_legend:
160-
self.add_legend(ax, self.cm, **legend_kwargs)
171+
self.add_legend(ax, self.cm, **kwargs)
161172

162173
def add_legend(self, ax, cmap, **legend_kwargs):
163-
"""Add a legend to the plot."""
174+
"""Add a legend to the plot.
175+
176+
Parameters
177+
----------
178+
ax : matplotlib.axes
179+
cmap : matplotlib.colormap
180+
181+
Keyword arguments passed to ax.legend:
182+
fontsize, markerscale
183+
"""
164184
leg = create_legend(ax, cmap, np.arange(cmap.N), self.common_unique)
165185

166186
extra = dict(bbox_to_anchor=(0.9, 0.05, 0.1, 0.1), ncol=cmap.N / 2,
167187
mode='scale', fancybox=False, shadow=False, fontsize=3.0,
168188
columnspacing=1.0, loc='center right', markerscale=0.7,
169189
framealpha=1.0, borderpad=0.5, handleheight=0.5,
170190
frameon=True)
171-
legend_kwargs.update(extra)
191+
192+
extra.update(legend_kwargs)
193+
ax.legend(handles=leg, **extra)
172194

173-
ax.legend(handles=leg, **legend_kwargs)

0 commit comments

Comments
 (0)