Skip to content

Example of Plotting Points Misleading #18

@coolum001

Description

@coolum001

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions