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

plot classified image #404

Open
12rambau opened this issue Dec 11, 2024 · 0 comments
Open

plot classified image #404

12rambau opened this issue Dec 11, 2024 · 0 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed kind: bug Something isn't working

Comments

@12rambau
Copy link
Member

The plot method from the ImageAccessor is plotting continuous images and has lots of difficulties to plot classified images. I tried to play with the cmap of the following graph but never managed to make it work:

landcover = ee.Image(
    ee.ImageCollection("USGS/NLCD_RELEASES/2019_REL/NLCD")
    .filter(ee.Filter.eq('system:index', '2016'))
    .first()
    .select('landcover')
)

roi = ee.Geometry.Polygon([[
    [-121.214213, 39.102459],
    [-121.214213, 39.109467],
    [-121.199295, 39.109467],
    [-121.199295, 39.102459],
    [-121.214213, 39.102459]
]])

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

landcover.geetools.plot(bands = ["landcover"], ax=ax, region=roi)

ax.set_xlabel("Longitude")
ax.set_ylabel("Latitude")
ax.tick_params(axis='both', which='both', length=0, labelbottom=False, labelleft=False)
ax.set_title("Landcover over a random AOI")
fig.colorbar(ax.images[0], label="landcover")

plt.show()

image

If someone finds a way to create a class clolorbar then it should be added to the documentation else a PR will be welcomed in the source code.

@12rambau 12rambau added help wanted Extra attention is needed good first issue Good for newcomers kind: bug Something isn't working labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed kind: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant