Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
and `~proplot.wrappers.fill_betweenx_wrapper` wrappers."""
obj = super().__getattribute__(attr, *args)
if callable(obj):
# Step 5) Color usage wrappers
if attr in wrappers._cmap_methods:
obj = wrappers._cmap_wrapper(self, obj)
elif attr in wrappers._cycle_methods:
obj = wrappers._cycle_wrapper(self, obj)
# Step 4) Fix coordinate grid
if attr in wrappers._edges_methods or attr in wrappers._centers_methods:
obj = wrappers._cartopy_gridfix(self, obj)
# Step 3) Utilities
if attr in wrappers._edges_methods:
obj = wrappers._enforce_edges(self, obj)
elif attr in wrappers._centers_methods:
obj = wrappers._enforce_centers(self, obj)
# Step 2) Better default keywords
if attr in wrappers._transform_methods:
obj = wrappers._cartopy_transform(self, obj)
elif attr in wrappers._crs_methods:
obj = wrappers._cartopy_crs(self, obj)
# Step 1) Parse args input
if attr in wrappers._2d_methods:
obj = wrappers._autoformat_2d_(self, obj)
elif attr in wrappers._1d_methods:
obj = wrappers._autoformat_1d_(self, obj)
# Step 0) Special wrappers
if attr=='plot':
obj = wrappers._plot_wrapper(self, obj)
elif attr=='scatter':
obj = wrappers._scatter_wrapper(self, obj)
elif attr=='fill_between':
def __getattribute__(self, attr, *args):
"""Applies the `~proplot.wrappers.cmap_wrapper`,
`~proplot.wrappers.cycle_wrapper`, `~proplot.wrappers.add_errorbars`,
`~proplot.wrappers.enforce_centers`, `~proplot.wrappers.enforce_edges`,
`~proplot.wrappers.plot_wrapper`, `~proplot.wrappers.scatter_wrapper`,
`~proplot.wrappers.bar_wrapper`, `~proplot.wrappers.barh_wrapper`,
`~proplot.wrappers.boxplot_wrapper`, `~proplot.wrappers.violinplot_wrapper`,
`~proplot.wrappers.fill_between_wrapper`, and `~proplot.wrappers.fill_betweenx_wrapper`
wrappers."""
obj = super().__getattribute__(attr, *args)
if callable(obj):
# Step 3) Color usage wrappers
if attr in wrappers._cmap_methods: # must come first!
obj = wrappers._cmap_wrapper(self, obj)
elif attr in wrappers._cycle_methods:
obj = wrappers._cycle_wrapper(self, obj)
# Step 2) Utilities
if attr in wrappers._centers_methods:
obj = wrappers._enforce_centers(self, obj)
elif attr in wrappers._edges_methods:
obj = wrappers._enforce_edges(self, obj)
elif attr in wrappers._errorbar_methods:
obj = wrappers._add_errorbars(self, obj)
# Step 1) Parse input
if attr in wrappers._2d_methods:
obj = wrappers._autoformat_2d_(self, obj)
elif attr in wrappers._1d_methods:
obj = wrappers._autoformat_1d_(self, obj)
# Step 0) Special wrappers
# Allocate invisible axes for drawing legend; by default try to
# make handles and stuff flush against the axes edge
kwdefault = {'borderaxespad': 0}
if not kwargs.get('frameon', rc['legend.frameon']):
kwdefault['borderpad'] = 0
kwdefault.update(kwargs)
kwargs = kwdefault
# Set location by panel side
# WARNING: center left and center right also turn off horizontal
# center alignment, so not an option.
if 'loc' in kwargs:
warnings.warn(f'Overriding user input legend property "loc".')
kwargs['loc'] = {'bottom':'upper center', 'right':'center left',
'left':'center right', 'top':'lower center'}[self._side]
# For filled axes, call wrapper method directly
return wrappers.legend_wrapper(self, *args, **kwargs)
if attr=='plot':
obj = wrappers._plot_wrapper(self, obj)
elif attr=='scatter':
obj = wrappers._scatter_wrapper(self, obj)
elif attr=='boxplot':
obj = wrappers._boxplot_wrapper(self, obj)
elif attr=='violinplot':
obj = wrappers._violinplot_wrapper(self, obj)
elif attr=='bar':
obj = wrappers._bar_wrapper(self, obj)
elif attr=='barh': # skips cycle wrapper and calls bar method
obj = wrappers._barh_wrapper(self, obj)
elif attr=='hist': # skips cycle wrapper and calls bar method
obj = wrappers._hist_wrapper(self, obj)
elif attr=='fill_between':
obj = wrappers._fill_between_wrapper(self, obj)
elif attr=='fill_betweenx':
obj = wrappers._fill_betweenx_wrapper(self, obj)
return obj
and ``_no_recurse`` wrappers. Respectively, these call methods on
the `~mpl_toolkits.basemap.Basemap` instance and prevent recursion
issues arising from internal `~mpl_toolkits.basemap` calls to the
axes methods."""
# WARNING: Never ever try to just make blanket methods on the Basemap
# instance accessible from axes instance! Can of worms and had bunch of
# weird errors! Just pick the ones you think user will want to use.
obj = super().__getattribute__(attr, *args)
if attr in wrappers._latlon_methods or attr in wrappers._edges_methods \
or attr in wrappers._centers_methods:
# Step 6) Call identically named Basemap object method
obj = wrappers._basemap_call(self, obj)
# Step 5) Color usage wrappers
if attr in wrappers._cmap_methods:
obj = wrappers._cmap_wrapper(self, obj)
elif attr in wrappers._cycle_methods:
obj = wrappers._cycle_wrapper(self, obj)
# Step 4) Fix coordinate grid
if attr in wrappers._edges_methods or attr in wrappers._centers_methods:
obj = wrappers._basemap_gridfix(self, obj)
# Step 3) Utilities
if attr in wrappers._edges_methods:
obj = wrappers._enforce_edges(self, obj)
elif attr in wrappers._centers_methods:
obj = wrappers._enforce_centers(self, obj)
# Step 2) Better default keywords
if attr in wrappers._latlon_methods:
obj = wrappers._basemap_latlon(self, obj)
# Step 1) Parse args input
if attr in wrappers._2d_methods:
obj = wrappers._autoformat_2d_(self, obj)
elif attr in wrappers._1d_methods:
# WARNING: Never ever try to just make blanket methods on the Basemap
# instance accessible from axes instance! Can of worms and had bunch of
# weird errors! Just pick the ones you think user will want to use.
obj = super().__getattribute__(attr, *args)
if attr in wrappers._latlon_methods or attr in wrappers._edges_methods \
or attr in wrappers._centers_methods:
# Step 6) Call identically named Basemap object method
obj = wrappers._basemap_call(self, obj)
# Step 5) Color usage wrappers
if attr in wrappers._cmap_methods:
obj = wrappers._cmap_wrapper(self, obj)
elif attr in wrappers._cycle_methods:
obj = wrappers._cycle_wrapper(self, obj)
# Step 4) Fix coordinate grid
if attr in wrappers._edges_methods or attr in wrappers._centers_methods:
obj = wrappers._basemap_gridfix(self, obj)
# Step 3) Utilities
if attr in wrappers._edges_methods:
obj = wrappers._enforce_edges(self, obj)
elif attr in wrappers._centers_methods:
obj = wrappers._enforce_centers(self, obj)
# Step 2) Better default keywords
if attr in wrappers._latlon_methods:
obj = wrappers._basemap_latlon(self, obj)
# Step 1) Parse args input
if attr in wrappers._2d_methods:
obj = wrappers._autoformat_2d_(self, obj)
elif attr in wrappers._1d_methods:
obj = wrappers._autoformat_1d_(self, obj)
# Step 0) Special wrappers
if attr=='plot':
obj = wrappers._plot_wrapper(self, obj)
# Step 1) Parse args input
if attr in wrappers._2d_methods:
obj = wrappers._autoformat_2d_(self, obj)
elif attr in wrappers._1d_methods:
obj = wrappers._autoformat_1d_(self, obj)
# Step 0) Special wrappers
if attr=='plot':
obj = wrappers._plot_wrapper(self, obj)
elif attr=='scatter':
obj = wrappers._scatter_wrapper(self, obj)
elif attr=='fill_between':
obj = wrappers._fill_between_wrapper(self, obj)
elif attr=='fill_betweenx':
obj = wrappers._fill_betweenx_wrapper(self, obj)
# Recursion fix at top level
obj = wrappers._no_recurse(self, obj)
return obj
def __getattribute__(self, attr, *args):
"""Applies the `~proplot.wrappers.text_wrapper` wrapper and disables
the redundant methods `_disabled_methods`. Enables the attribute aliases
``bpanel`` for ``bottompanel``, ``tpanel`` for ``toppanel``,
``lpanel`` for ``leftpanel``, and ``rpanel`` for ``rightpanel``."""
attr = _panel_aliases.get(attr, attr)
obj = super().__getattribute__(attr, *args)
# Disabled methods
for message,attrs in wrappers._disabled_methods.items():
if attr in attrs:
raise RuntimeError(message.format(attr))
# Non-plotting overrides
# All plotting overrides are implemented in individual subclasses
if attr=='text':
obj = wrappers._text_wrapper(self, obj)
return obj
elif attr in wrappers._errorbar_methods:
obj = wrappers._add_errorbars(self, obj)
# Step 1) Parse input
if attr in wrappers._2d_methods:
obj = wrappers._autoformat_2d_(self, obj)
elif attr in wrappers._1d_methods:
obj = wrappers._autoformat_1d_(self, obj)
# Step 0) Special wrappers
if attr=='plot':
obj = wrappers._plot_wrapper(self, obj)
elif attr=='scatter':
obj = wrappers._scatter_wrapper(self, obj)
elif attr=='boxplot':
obj = wrappers._boxplot_wrapper(self, obj)
elif attr=='violinplot':
obj = wrappers._violinplot_wrapper(self, obj)
elif attr=='bar':
obj = wrappers._bar_wrapper(self, obj)
elif attr=='barh': # skips cycle wrapper and calls bar method
obj = wrappers._barh_wrapper(self, obj)
elif attr=='hist': # skips cycle wrapper and calls bar method
obj = wrappers._hist_wrapper(self, obj)
elif attr=='fill_between':
obj = wrappers._fill_between_wrapper(self, obj)
elif attr=='fill_betweenx':
obj = wrappers._fill_betweenx_wrapper(self, obj)
return obj
elif attr in wrappers._edges_methods:
obj = wrappers._enforce_edges(self, obj)
elif attr in wrappers._errorbar_methods:
obj = wrappers._add_errorbars(self, obj)
# Step 1) Parse input
if attr in wrappers._2d_methods:
obj = wrappers._autoformat_2d_(self, obj)
elif attr in wrappers._1d_methods:
obj = wrappers._autoformat_1d_(self, obj)
# Step 0) Special wrappers
if attr=='plot':
obj = wrappers._plot_wrapper(self, obj)
elif attr=='scatter':
obj = wrappers._scatter_wrapper(self, obj)
elif attr=='boxplot':
obj = wrappers._boxplot_wrapper(self, obj)
elif attr=='violinplot':
obj = wrappers._violinplot_wrapper(self, obj)
elif attr=='bar':
obj = wrappers._bar_wrapper(self, obj)
elif attr=='barh': # skips cycle wrapper and calls bar method
obj = wrappers._barh_wrapper(self, obj)
elif attr=='hist': # skips cycle wrapper and calls bar method
obj = wrappers._hist_wrapper(self, obj)
elif attr=='fill_between':
obj = wrappers._fill_between_wrapper(self, obj)
elif attr=='fill_betweenx':
obj = wrappers._fill_betweenx_wrapper(self, obj)
return obj