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

Add image chart functions #1855

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add image chart functions #1855

wants to merge 6 commits into from

Conversation

giswqs
Copy link
Member

@giswqs giswqs commented Dec 19, 2023

This PR adds more charting functions to the chart module.

Reference: https://developers.google.com/earth-engine/guides/charts_image

chart.image_byRegion

ecoregions = ee.FeatureCollection('projects/google/charts_feature_example')
normClim = ee.ImageCollection('OREGONSTATE/PRISM/Norm81m').toBands().select('[0-9][0-9]_tmean')
labels = list(calendar.month_abbr)[1:] # a list of month labels, e.g. ['Jan', 'Feb', ...]

chart.image_byRegion(
    image=normClim, 
    regions=ecoregions, 
    reducer="mean", 
    scale=500, 
    xProperty='label', 
    xlabel='Ecoregion',
    ylabel='Temperature',
    labels=labels,
    # colors=['red', 'green', 'blue'],
    )


@giswqs giswqs requested a review from jdbcode December 19, 2023 21:14
Copy link

github-actions bot commented Dec 19, 2023

@github-actions github-actions bot temporarily deployed to pull request December 19, 2023 21:21 Inactive
@giswqs
Copy link
Member Author

giswqs commented Dec 19, 2023

chart.image_byClass

Reference: https://developers.google.com/earth-engine/guides/charts_image#uichartimagebyclass

bqplot example with line smoothing

import numpy as np
import bqplot.pyplot as plt

fig = plt.figure(title="Random Walks")
x = np.arange(100)
# three random walks
y = np.random.randn(3, 100).cumsum(axis=1)

lines = plt.plot(
    x, y,
    labels=["Line1", "Line2", "Line 3"],
    display_legend=True
)

# Plot the lines with interpolation
line1 = plt.plot(x, y[0], 'b-', label='Line 1', interpolation='basis')
line2 = plt.plot(x, y[1], 'r-', label='Line 2', interpolation='step-after')
line3 = plt.plot(x, y[2], 'g-', label='Line 3', interpolation='cardinal')

plt.show()

@jdbcode
Copy link
Collaborator

jdbcode commented Dec 20, 2023

Hi @giswqs, just a quick note to say I see the review request and will follow up shortly.

@giswqs
Copy link
Member Author

giswqs commented Dec 20, 2023

No rush. I will be adding more commit over the next few days.

@github-actions github-actions bot temporarily deployed to pull request December 22, 2023 19:59 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 22, 2023 21:25 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 25, 2023 04:38 Inactive
@jdbcode
Copy link
Collaborator

jdbcode commented Jan 3, 2024

It looks like you're maybe still working on chart.image_byClass?
I saw the new Image_byClass class but the image_byClass function is unchanged from todo. Do you want to add it to this PR, or would you like to merge the current changes?

@giswqs
Copy link
Member Author

giswqs commented Jan 3, 2024

@jdbcode Thanks fort testing it. I will be adding more classes and functions. Don't merge this PR yet.

@jdbcode
Copy link
Collaborator

jdbcode commented Jan 3, 2024

Sounds good

@github-actions github-actions bot temporarily deployed to pull request January 3, 2024 21:55 Inactive
@smith-kyle
Copy link

I'm a little late to the party, but I noticed you all aren't using a notebook review tool and wanted to invite you to review this pull request with GitNotebooks: https://gitnotebooks.com/gee-community/geemap/pull/1855

It lets you do things like comment on rendered markdown and code cells, so might be an easy win for your PR reviews.

@github-actions github-actions bot temporarily deployed to pull request February 15, 2024 23:09 Inactive
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

Successfully merging this pull request may close these issues.

None yet

3 participants