Skip to content

Commit

Permalink
fix bbox new definition for test error
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyeehh committed Dec 6, 2024
1 parent b16422c commit f833067
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions tests/visualization/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_all_None(self):
def test_locations(self, test_data):
"""Test reading of locations bounds"""
_, _, _, locs = test_data
n, s, e, w = _calculate_bounds(None, None, None, locs)
w, s, e, n = _calculate_bounds(None, None, None, locs)
assert n >= locs.geometry.y.max()
assert s <= locs.geometry.y.min()
assert e >= locs.geometry.x.max()
Expand All @@ -162,7 +162,7 @@ def test_locations(self, test_data):
def test_triplegs(self, test_data):
"""Test reading of triplegs bounds"""
_, _, tpls, locs = test_data
n, s, e, w = _calculate_bounds(None, None, tpls, locs)
w, s, e, n = _calculate_bounds(None, None, tpls, locs)
bounds = tpls.bounds
assert n >= max(bounds.maxy)
assert s <= min(bounds.miny)
Expand All @@ -172,7 +172,7 @@ def test_triplegs(self, test_data):
def test_staypoints(self, test_data):
"""Test reading of staypoint bounds"""
_, sp, tpls, locs = test_data
n, s, e, w = _calculate_bounds(None, sp, tpls, locs)
w, s, e, n = _calculate_bounds(None, sp, tpls, locs)
assert n >= sp.geometry.y.max()
assert s <= sp.geometry.y.min()
assert e >= sp.geometry.x.max()
Expand All @@ -181,7 +181,7 @@ def test_staypoints(self, test_data):
def test_positionfixes(self, test_data):
"""Test reading of positionfixes bounds"""
pfs, sp, tpls, locs = test_data
n, s, e, w = _calculate_bounds(pfs, sp, tpls, locs)
w, s, e, n = _calculate_bounds(pfs, sp, tpls, locs)
assert n >= pfs.geometry.y.max()
assert s <= pfs.geometry.y.min()
assert e >= pfs.geometry.x.max()
Expand Down Expand Up @@ -213,7 +213,7 @@ def test_plot_file(self, test_data):
def test_osm(self, test_data):
"""Test call to plot_osm"""
pfs, sp, tpls, locs = test_data
n, s, e, w = _calculate_bounds(*test_data)
w, s, e, n = _calculate_bounds(*test_data)
_, ax = regular_figure()
plot(positionfixes=pfs, staypoints=sp, triplegs=tpls, locations=locs, plot_osm=True, ax=ax)
assert ax.get_xlim() == (w, e)
Expand Down
4 changes: 2 additions & 2 deletions trackintel/visualization/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def _calculate_bounds(positionfixes, staypoints, triplegs, locations):
south = locations.geometry.y.min() - 0.03
east = locations.geometry.x.max() + 0.03
west = locations.geometry.x.min() - 0.03
return (north, south, east, west)
return (west, south, east, north)


def _plot_frames(positionfixes, staypoints, triplegs, locations, radius_sp, radius_locs, ax):
Expand Down Expand Up @@ -310,7 +310,7 @@ def plot(

positionfixes, staypoints, triplegs, locations = _prepare_frames(positionfixes, staypoints, triplegs, locations)
if plot_osm:
north, south, east, west = bbox = _calculate_bounds(positionfixes, staypoints, triplegs, locations)
west, south, east, north = bbox = _calculate_bounds(positionfixes, staypoints, triplegs, locations)
plot_osm_streets(bbox, ax=ax)
ax.set_xlim([west, east])
ax.set_ylim([south, north])
Expand Down

0 comments on commit f833067

Please sign in to comment.