Skip to content
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

Example of Plotting Points Misleading #18

Open
coolum001 opened this issue May 28, 2019 · 0 comments
Open

Example of Plotting Points Misleading #18

coolum001 opened this issue May 28, 2019 · 0 comments

Comments

@coolum001
Copy link

The example of how to plot a point at a lat, lon coordinate is a little misleading.

First, if (for example) the east side of the bounding box is all ocean, then the plotted ridges will be trimmed to be just the dry land (try rm = RidgeMap( (153.0, -26.6, 153.2, -26.4))

Thus the calculation of the mapping between the desired lat, lon and the Axes coordinates will be wrong. Even if the plotted ridges span all the bounding box, the surrounding border will introduce an error, I believe.

You can force the Axes to enclosed the entire bounding box by setting the Axes x and y limits


values = rm.get_elevation_data(num_lines=100)
print('Before preprocess', values.shape)
values = rm.preprocess(values=values)
print('After preprocess', values.shape)


fig, ax = plt.subplots(figsize=(20,20))
ax.set_xlim(0,values.shape[1])
ax.set_ylim(-6*values.shape[0], 0)

This sets the Axes x and y limits (and sadly removes the nice empty border).

Now the following code to plot a point will work (I may have the Latitude slightly wrong).

home= 153.087, -26.5269739
home_coords = ((home[0] - rm.longs[0])/(rm.longs[1] - rm.longs[0]),(home[1] - rm.lats[0])/(rm.lats[1] - rm.lats[0]))

print(home)
print(home_coords)
print(rm.longs)
print(rm.lats)

my_map.plot(*home_coords, 'o', color='r', transform=my_map.transAxes, zorder=len(values)+10)

home_coords = (0.01, 0.01)
my_map.plot(*home_coords, 'o', color='r', transform=my_map.transAxes, zorder=len(values)+10)

home_coords = (0.01, 0.99)
my_map.plot(*home_coords, 'o', color='r', transform=my_map.transAxes, zorder=len(values)+10)

home_coords = (0.99, 0.99)
my_map.plot(*home_coords, 'o', color='r', transform=my_map.transAxes, zorder=len(values)+10)

home_coords = (0.99, 0.01)
my_map.plot(*home_coords, 'o', color='r', transform=my_map.transAxes, zorder=len(values)+10)

RM-BUG

Environment is:


python version : 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)]
python environment : ac5-py37
pandas version : 0.23.4
current wkg dir: C:\Users\donrc\Documents\JupyterNotebooks\RidgeMapProjectNotebookProject\develop
Notebook name: 2019-05-23-dc-RidgeMapNotebook.ipynb
Notebook run at: 2019-05-28 17:37:29.093947 local time
Notebook run at: 2019-05-28 07:37:29.093947 UTC
Notebook run on: Windows-10-10.0.17134-SP0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant