Announcement: All noncommercial projects registered to use Earth Engine beforeApril 15, 2025 mustverify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.

ui.Chart.image.byClass

  • ui.Chart.image.byClass generates a chart from an image, plotting derived band values in classified regions.

  • The chart's x-axis represents the band name, the y-axis represents the band value, and the series represents the class label.

  • The function takes several arguments including the classified image, class band, optional region, reducer, scale, class labels, and x-labels.

  • It returns aui.Chart object.

Generates a Chart from an image. Plots derived band values in classified regions in an image.

  - X-axis = Band name (all bands except the class band are charted).

  - Y-axis = Band value.

  - Series = Class label.

Returns a chart.

UsageReturns
ui.Chart.image.byClass(image, classBand,region,reducer,scale,classLabels,xLabels)ui.Chart
ArgumentTypeDetails
imageImageClassified image to derive band values from.
classBandNumber|StringThe class label band in this image.
regionFeature|FeatureCollection|Geometry, optionalThe region to reduce. If omitted, uses the entire image.
reducerReducer, optionalReducer that generates the value(s) for the y-axis. Must return a single value per band. Defaults to ee.Reducer.mean().
scaleNumber, optionalScale to use with the reducer in meters.
classLabelsList.<String>|List<String>|Object, optionalA dictionary of labels used to identify classes in the series legend. If omitted, classes will be labeled with the value of classBand.
xLabelsList<Object>, optionalA list of labels used to label bands on the xAxis. Must have one fewer elements than the number of image bands. If omitted, bands will be labeled with their names. If the labels are numeric (e.g. wavelengths), x-axis will be continuous.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-08 UTC.