If I use python api for google earth engine and want to make a UI chart for mean value of NDVI for a particular year , how does the UI.CHART function work in python api for google earth engine.

2 Answers 2


There is a library in the universe of Jake Vanderplas that I have used to make charts in Google Earth Engine: pygal. May not be the best or newest, but it works. I have incorporated the method in a python package called ipygee. You can install it via pip.

At the moment, the only method available is series (to plot a time series), but I am about to incorporate seriesByRegion, because I need them for work, the rest will have to wait.

There is a notebook in which I show how to use it: Chart.ipynb, and the equivalent code in JS (https://code.earthengine.google.com/e50afcbdc75fbb9611a4ac7d6567fdf8)

I leave the code here as well:

# coding: utf-8
# # chart module

import ee    
import ipygee as ui

test_site = ee.Geometry.Point([-71, -42])
# ## Time Series
years = ee.List([2015, 2016, 2017, 2018])
col = ee.ImageCollection('COPERNICUS/S2').filterBounds(test_site)

def make_time_series(year):
    ''' make a time series from years list '''
    eefilter = ee.Filter.calendarRange(year, field='year')
    filtered = col.filter(eefilter)
    return filtered.mean().set('system:time_start', ee.Date.fromYMD(year, 1, 1).millis())

time_series = ee.ImageCollection(years.map(make_time_series))

# ## Chart *series*
chart_ts = ui.chart.Image.series(**{
    'imageCollection': time_series, 
    'region': test_site,
    'scale': 10,
    'bands': ['B1', 'B2', 'B3']

# chart_ts.renderWidget()  # for Jupyter Notebook or Lab
chart_ts.render_in_browser()  # for Spyder

As the resulting chart chart_ts is a subclass of a pygal chart, you can use all its methods, like render_to_file, etc, and all its attributes.

  • 1
    I already finished seriesByRegion =) Commented Aug 10, 2018 at 17:20
  • 1
    Would "from geetools import chart" now be "from ipygee import chart" ?
    – svollowork
    Commented Oct 4, 2021 at 10:46
  • yes! thank you @svollowork Commented Oct 5, 2021 at 12:01

The ui.Chart class is only available in the Earth Engine Code Editor application. It is not part of the JavaScript or Python API libraries.

Using the Earth Engine Python API, you can pull data into a Python data structure (such as a Pandas dataframe) and use a wide variety of Python visualization libraries to view the data. For a good overview of popular libraries, see Jake Vanderplas' talk The Python Visualization Landscape from PyCon 2017.

  • Thank you Tyler for the suggestion. I am presently working with real time analysis using Earth Engine and it would be great to stay in touch Commented Aug 7, 2018 at 6:23
  • when working with large data I think it is not a best practice to pull the data into the client-side. Is there any way to work on charts on the server-side using Python API? Commented Dec 20, 2021 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.