Skip to content

Remove old handling for factor=None in axisartist. #23467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 16 additions & 32 deletions lib/mpl_toolkits/axisartist/floating_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,12 @@ def get_tick_iterators(self, axes):
grid_finder = self.grid_helper.grid_finder

lat_levs, lat_n, lat_factor = self._grid_info["lat_info"]
lon_levs, lon_n, lon_factor = self._grid_info["lon_info"]
yy0 = lat_levs / lat_factor
dy = 0.001 / lat_factor

lon_levs, lat_levs = np.asarray(lon_levs), np.asarray(lat_levs)
if lat_factor is not None:
yy0 = lat_levs / lat_factor
dy = 0.001 / lat_factor
else:
yy0 = lat_levs
dy = 0.001

if lon_factor is not None:
xx0 = lon_levs / lon_factor
dx = 0.001 / lon_factor
else:
xx0 = lon_levs
dx = 0.001
lon_levs, lon_n, lon_factor = self._grid_info["lon_info"]
xx0 = lon_levs / lon_factor
dx = 0.001 / lon_factor

extremes = self.grid_helper._extremes
xmin, xmax = sorted(extremes[:2])
Expand Down Expand Up @@ -242,31 +232,25 @@ def _update_grid(self, x1, y1, x2, y2):

lon_min, lon_max = sorted(extremes[:2])
lat_min, lat_max = sorted(extremes[2:])
grid_info["extremes"] = lon_min, lon_max, lat_min, lat_max # extremes

lon_levs, lon_n, lon_factor = \
grid_finder.grid_locator1(lon_min, lon_max)
lon_levs = np.asarray(lon_levs)
lat_levs, lat_n, lat_factor = \
grid_finder.grid_locator2(lat_min, lat_max)
grid_info["extremes"] = lon_min, lon_max, lat_min, lat_max # extremes
lat_levs = np.asarray(lat_levs)

grid_info["lon_info"] = lon_levs, lon_n, lon_factor
grid_info["lat_info"] = lat_levs, lat_n, lat_factor

grid_info["lon_labels"] = grid_finder.tick_formatter1("bottom",
lon_factor,
lon_levs)

grid_info["lat_labels"] = grid_finder.tick_formatter2("bottom",
lat_factor,
lat_levs)

if lon_factor is None:
lon_values = np.asarray(lon_levs[:lon_n])
else:
lon_values = np.asarray(lon_levs[:lon_n]/lon_factor)
if lat_factor is None:
lat_values = np.asarray(lat_levs[:lat_n])
else:
lat_values = np.asarray(lat_levs[:lat_n]/lat_factor)
grid_info["lon_labels"] = grid_finder.tick_formatter1(
"bottom", lon_factor, lon_levs)
grid_info["lat_labels"] = grid_finder.tick_formatter2(
"bottom", lat_factor, lat_levs)

lon_values = lon_levs[:lon_n] / lon_factor
lat_values = lat_levs[:lat_n] / lat_factor

lon_lines, lat_lines = grid_finder._get_raw_grid_lines(
lon_values[(lon_min < lon_values) & (lon_values < lon_max)],
Expand Down
2 changes: 2 additions & 0 deletions lib/mpl_toolkits/axisartist/grid_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ def get_grid_info(self, x1, y1, x2, y2):

lon_min, lon_max, lat_min, lat_max = extremes
lon_levs, lon_n, lon_factor = self.grid_locator1(lon_min, lon_max)
lon_levs = np.asarray(lon_levs)
lat_levs, lat_n, lat_factor = self.grid_locator2(lat_min, lat_max)
lat_levs = np.asarray(lat_levs)

lon_values = lon_levs[:lon_n] / lon_factor
lat_values = lat_levs[:lat_n] / lat_factor
Expand Down
6 changes: 2 additions & 4 deletions lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def update_lim(self, axes):

self._grid_info = {
"extremes": (lon_min, lon_max, lat_min, lat_max),
"lon_info": (lon_levs, lon_n, lon_factor),
"lat_info": (lat_levs, lat_n, lat_factor),
"lon_info": (lon_levs, lon_n, np.asarray(lon_factor)),
"lat_info": (lat_levs, lat_n, np.asarray(lat_factor)),
"lon_labels": grid_finder.tick_formatter1(
"bottom", lon_factor, lon_levs),
"lat_labels": grid_finder.tick_formatter2(
Expand Down Expand Up @@ -170,12 +170,10 @@ def get_tick_iterators(self, axes):
grid_finder = self.grid_helper.grid_finder

lat_levs, lat_n, lat_factor = self._grid_info["lat_info"]
lat_levs = np.asarray(lat_levs)
yy0 = lat_levs / lat_factor
dy = 0.01 / lat_factor

lon_levs, lon_n, lon_factor = self._grid_info["lon_info"]
lon_levs = np.asarray(lon_levs)
xx0 = lon_levs / lon_factor
dx = 0.01 / lon_factor

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy