- แกน X: ที่เก็บข้อมูลฮิสโตแกรม (ของค่าแถบ)
- แกน Y: ความถี่ (จำนวนพิกเซลที่มีค่าแถบในกลุ่ม)
แสดงผลแผนภูมิ
| การใช้งาน | การคืนสินค้า |
|---|---|
ui.Chart.image.histogram(image, region, scale, maxBuckets, minBucketWidth, maxRaw, maxPixels) | ui.Chart |
| อาร์กิวเมนต์ | ประเภท | รายละเอียด |
|---|---|---|
image | รูปภาพ | รูปภาพที่จะสร้างฮิสโทแกรม |
region | Feature|FeatureCollection|Geometry, ไม่บังคับ | ภูมิภาคที่จะลด หากละไว้ ให้ใช้ทั้งรูปภาพ |
scale | หมายเลข (ไม่บังคับ) | มาตราส่วนพิกเซลที่ใช้เมื่อใช้ตัวลดฮิสโตแกรมในหน่วยเมตร |
maxBuckets | หมายเลข (ไม่บังคับ) | จำนวนที่เก็บข้อมูลสูงสุดที่จะใช้เมื่อสร้างฮิสโตแกรม โดยจะปัดขึ้นเป็นเลขยกกำลังของ 2 |
minBucketWidth | หมายเลข (ไม่บังคับ) | ความกว้างของ Bucket ฮิสโทแกรมขั้นต่ำ หรือ null เพื่ออนุญาตให้ใช้กำลัง 2 ใดก็ได้ |
maxRaw | หมายเลข (ไม่บังคับ) | จำนวนค่าที่จะสะสมก่อนสร้างฮิสโทแกรมเริ่มต้น |
maxPixels | หมายเลข (ไม่บังคับ) | หากระบุไว้ จะลบล้างจำนวนพิกเซลสูงสุดที่อนุญาตในการลดฮิสโทแกรม ค่าเริ่มต้นคือ 1e6 |
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (JavaScript)
// Define a MODIS surface reflectance composite. var modisSr = ee.ImageCollection('MODIS/006/MOD09A1') .filter(ee.Filter.date('2018-06-01', '2018-09-01')) .select(['sur_refl_b01', 'sur_refl_b02', 'sur_refl_b06']) .mean(); // Define a region to calculate histogram for. var histRegion = ee.Geometry.Rectangle([-112.60, 40.60, -111.18, 41.22]); // Define the chart and print it to the console. var chart = ui.Chart.image.histogram({image: modisSr, region: histRegion, scale: 500}) .setSeriesNames(['Red', 'NIR', 'SWIR']) .setOptions({ title: 'MODIS SR Reflectance Histogram', hAxis: { title: 'Reflectance (scaled by 1e4)', titleTextStyle: {italic: false, bold: true}, }, vAxis: {title: 'Count', titleTextStyle: {italic: false, bold: true}}, colors: ['cf513e', '1d6b99', 'f0af07'] }); print(chart);