[x,y] = ginput(n) allows you to identify the coordinates of n points within Cartesian, polar, or geographic axes. To choose a point, move your cursor to the desired location and press either a mouse button or a key on the keyboard. Press the Return key to stop before all n points are selected. MATLAB® returns the coordinates of your selected points. If there are no axes, calling ginput creates a Cartesian axes object.
import xarray as xr
import hvplot.xarray
from holoviews.streams import PointDraw
import holoviews as hv
from holoviews import opts
url = 's3://landsat-pds/c1/L8/042/034/LC08_L1TP_042034_20170616_20170629_01_T1/LC08_L1TP_042034_20170616_20170629_01_T1_B4.TIF'
da = xr.open_rasterio(url).squeeze('band')
image = da.hvplot.image(rasterize=True, cmap='turbo', data_aspect=1)
points = hv.Points([[da.x.mean().values, da.y.mean().values]])
point_stream = PointDraw(source=points)
(image * points).opts(
opts.Points(size=20, color='black', marker='x'))
if point_stream.data:
display(point_stream.element.dframe())
x | y | |
---|---|---|
0 | 321600.0 | 4148850.0 |