MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / GridHelperRectlinear

Class GridHelperRectlinear

lib/mpl_toolkits/axisartist/axislines.py:302–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300
301
302class GridHelperRectlinear(GridHelperBase):
303
304 def __init__(self, axes):
305 super().__init__()
306 self.axes = axes
307
308 def new_fixed_axis(
309 self, loc, *, axis_direction=None, offset=None, axes=None
310 ):
311 if axes is None:
312 _api.warn_external(
313 "'new_fixed_axis' explicitly requires the axes keyword.")
314 axes = self.axes
315 if axis_direction is None:
316 axis_direction = loc
317 return AxisArtist(axes, FixedAxisArtistHelperRectilinear(axes, loc),
318 offset=offset, axis_direction=axis_direction)
319
320 def new_floating_axis(self, nth_coord, value, axis_direction="bottom", axes=None):
321 if axes is None:
322 _api.warn_external(
323 "'new_floating_axis' explicitly requires the axes keyword.")
324 axes = self.axes
325 helper = FloatingAxisArtistHelperRectilinear(
326 axes, nth_coord, value, axis_direction)
327 axisline = AxisArtist(axes, helper, axis_direction=axis_direction)
328 axisline.line.set_clip_on(True)
329 axisline.line.set_clip_box(axisline.axes.bbox)
330 return axisline
331
332 def get_gridlines(self, which="major", axis="both"):
333 """
334 Return list of gridline coordinates in data coordinates.
335
336 Parameters
337 ----------
338 which : {"both", "major", "minor"}
339 axis : {"both", "x", "y"}
340 """
341 _api.check_in_list(["both", "major", "minor"], which=which)
342 _api.check_in_list(["both", "x", "y"], axis=axis)
343 gridlines = []
344
345 if axis in ("both", "x"):
346 locs = []
347 y1, y2 = self.axes.get_ylim()
348 if which in ("both", "major"):
349 locs.extend(self.axes.xaxis.major.locator())
350 if which in ("both", "minor"):
351 locs.extend(self.axes.xaxis.minor.locator())
352 gridlines.extend([[x, x], [y1, y2]] for x in locs)
353
354 if axis in ("both", "y"):
355 x1, x2 = self.axes.get_xlim()
356 locs = []
357 if self.axes.yaxis._major_tick_kw["gridOn"]:
358 locs.extend(self.axes.yaxis.major.locator())
359 if self.axes.yaxis._minor_tick_kw["gridOn"]:

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…