Scatter Plots
The Scatter Plot Tool allows you to interactively classify two bands of raster data. One band provides the x coordinates and the other band provides the y coordinates. If the bands do not contain dependent data, either band can be plotted on either axis and the Scatter Plot illustrates only the degree of correlation between the two bands.
Tip: If a pyramid file does not exist and downsampling is not available for the input raster, the 2D Scatter Plot tool will not be available for use.
Click on any of the following links for details:
- Create a Scatter Plot
- Scatter Plot Navigation Controls
- Interactively View Pixel Distribution by Class
- Display Pixel Distribution with Density Slice
- Use ROIs with the Scatter Plot
- Calculate the Mean Spectra
- Create a Spectral Profile
- Create and Manage Classes
- Set Band Resolution
- Export the Scatter Plot
- Calculate Class Statistics
Create a Scatter Plot
To create a 2D Scatter Plot:
- Open a raster file.
-
Select one of the following:
- Click the Scatter Plot Tool button on the toolbar.
- Select Display > 2D Scatter Plot on the menu bar.
The Scatter Plot Tool dialog appears, and a Scatter Plot layer is added to the Layer Manager. To change the name and color of the Scatter Plot classes, see Create and Manage Classes.
- By default, the Scatter Plot is computed on the pixels visible in the view. This is useful with large files, as it provides quick interactive response time. To include the full range of data in the Scatter Plot, enable the Full Extent check box in the Scatter Plot Tool dialog.
- To select different bands from the current raster, move the x and y slider bars in the Scatter Plot Tool to select a new band, or enter a band number in the field provided with the slider bar.
- To select a band from a different open raster, select File > Select New Band > X-Axis or Y-Axis from the Scatter Plot Tool menu bar. In the Data Selection dialog that appears, select the new band and click OK. The second raster must match the current spatial size of the Scatter Plot.
- In the Layer Manager, select the raster to use for the plot.
- From the main menu bar, select Display > 2D Scatter Plot. A new Scatter Plot Tool dialog opens, and you can adjust the bands used for the plot as needed.
The Full Extent option provides a qualitative representation of the data, and it has limitations that you should be aware of. For example, if you draw a ROI around the entire scatterplot and Full Extent is enabled, you may see some missing pixels, or holes, in the resulting class displayed in the view. This is expected. A reduced-resolution version of the data (called a pyramid) is used to create the scatter plot when the Full Extent option is enabled. Small differences in data values between the reduced-resolution version of the data and the full-resolution data can result in missing pixels. This primarily occurs with very bright and dark pixels that occur at the extreme ends of the histogram, although some holes can occur with a few data values in the middle of the histogram.
The Green band is the default y band in the plot, and the Red band is the default x band. You can select different bands from the same image or bands from another image to create the Scatter Plot as follows:
You can have multiple Scatter Plots active simultaneously. To open another Scatter Plot:
Scatter Plot Navigation Controls
- To zoom in or out of the plot, click in the Scatter Plot and roll the mouse wheel up to zoom in, and down to zoom out. Or, press and hold the middle mouse button (wheel) and use Ctrl+drag to draw a box around the area to zoom into. To reset the plot view, click the Reset Range button .
- If the Scatter Full Extent mode is disabled, you can zoom into both the view and Scatter Plot. Click in the view and roll the mouse wheel up or down.
- You can click on other manipulators in the main toolbar to zoom, pan, fly, and so forth in the view. To return the focus to the Scatter Plot window, click the Scatter Plot Tool button.
Interactively View Pixel Distribution by Class
You can interactively view the distribution of a pixel value under the cursor (called dancing pixels).
The cursor size for viewing pixel distribution is set in the Patch Size parameter, which has a default setting of 10x10 pixels. The patch size for the view and Scatter Plot can be set independently. To change the patch size, right-click in the view or in the Scatter Plot and select Patch Size > size. You can set the value to 1x1, 5x5, 10x10, or 25x25 pixels.
- To highlight pixel distribution in the Scatter Plot, click and hold the left mouse button as you move the cursor over the view. The points in the plot that correspond to the values under the cursor will highlight in the Scatter Plot using the current class color.
- To highlight pixel distribution in the view, press and hold the Ctrl key+left mouse button as you move the cursor over the Scatter Plot. The pixels in the raster that correspond to the values under the cursor will highlight in the view using the current class color.
- When you zoom into the Scatter Plot, the resulting plot may not be square and the patch size will be distorted to a rectangle. To get square pixels again, resize the X,Y axis of the plot. Select Options > Change Scatter Plot Axis Ranges from the Scatter Plot Tool menu. In the Change Scatter Plot Axis Ranges dialog, adjust the Min and Max settings for the X-Axis and Y-Axis to square the Scatter Plot.
- You can also view pixel distribution as a dancing layer, where both the Scatter Plot and the view highlight the value that corresponds to the cursor location. Right-click in the view and select Cursor Mode > Dancing Layers, then click and hold the left mouse button as you move the cursor over the view. The points in the Scatter Plot and the pixels in the view that correspond to the values under the cursor will highlight in the selected class color.
Display Pixel Distribution with Density Slice
A group of pixels in the raster can share the same value in both bands. Those pixels will be represented by the same black points on the Scatter Plot. To display the point density in the Scatter Plot by color, click the Toggle Density Slice button on the Scatter Plot toolbar. The color gradient runs from low density to high density.
To change the color table for the density slice:
- From the Scatter Plot Tool menu bar, select Options > Change Density Slice Lookup. The Select Density Slice Color Lookup dialog appears.
- Select a color table from the drop-down list. For color tables that have black on the lower end, setting a higher color value to represent the lowest density points in the Scatter Plot applies more visible colors (instead of black) to those points so that all pixels in the Scatter Plot are visible.
- To reverse the order of the color gradient, click the Reverse button.
- Click OK to apply the color changes to the Scatter Plot.
Use ROIs with the Scatter Plot
You can use ROIs with the Scatter Plot to do a quick classification. ROIs can be created on-the-fly in the view or imported from an existing ROI file. You can export and save the ROIs you create for use in other full-band classifications.
To create a new ROI:
- Right click the view and select Cursor Mode > Region of Interest.
- Draw a polygon over an area of the image.
- Right-click and select Complete and Accept Polygon. The pixels that have similar spectral characteristics in the two selected bands are highlighted in the current class color in the view and in the Scatter Plot.
- Draw additional polygons to define the current class, or create a new class to define another ROI.
- To export the class to an ROI layer, from the Scatter Plot Tool menu select File > Export Class to ROI to export the selected class, or File > Export All Classes to ROIs to export all defined classes. The exported ROIs are added to the Layer Manager under the Regions of Interest folder for the associated raster.
To import an existing ROI file:
- Open the ROI file to import.
- From the Scatter Plot toolbar, select File > Import ROIs. The Choose ROIs dialog appears.
- Select the ROIs to import.
- Click OK. The imported ROIs appear in the Layer Manager under the Classes folder of the Scatter Plot layer. For details on how to manage ROIs, see Region of Interest (ROI) Tool.
Calculate the Mean Spectra
To calculate the mean spectra for the selected class or for all defined classes, right-click in the Scatter Plot Tool and select Mean Class (for the selected class), or Mean All (for all defined classes). The Scatter Plot Spectra window appears.
ENVI calculates the mean spectra and displays it in a plot window. If a Spectral Profile associated with the Scatter Plot is open, the same data is automatically to use to calculate the mean spectra. For details on how to use the Spectral Profile, see Spectral Profile.
Create a Spectral Profile
To associate a Spectral Profile with the Scatter Plot, right-click in the data of the Scatter Plot Tool and select Plot Spectral Profile. The Scatter Plot Spectra window appears.
- To plot individual spectra, press and hold the Ctrl key as you right-click points in the Scatter Plot.
- To plot multiple spectra, press and hold the Shift key as you right-click points in the Scatter Plot.
- To extract the spectrum for the selected pixel from an additional file, select Options > Add Spectral Plot from the Scatter Plot Tool menu, then select the input file. The input file must be the same spatial size as the as the original input file. The curve from the additional file is added to the Scatter Plot Spectra window. This option is useful when the X,Y bands of the Scatter Plot are from different source files, or if you have multiple product files that originate from the same source (for example, classification rule images of different algorithms).
For details on the main menu and right-click menu of the Scatter Plot Spectra window, see Spectral Profile.
Create and Manage Classes
You can create a class by selecting one or more groups of points in the Scatter Plot that highlight the associated pixels in the view. The Scatter Plot classes display in the Layer Manager under the Classes folder. You can change the class name and color, which is described below.
To create a class:
- From the Spectral Profile toolbar, click the Add New Class button .
- The class name is assigned by default as Class n, where n increments with each new class you create. To change the class name (for example, to
Water
), select the Class name from the drop-down list, type a new name, and press the Enter key to accept the change. - The class color is assigned by default. To change the color, click the Current Class Color button to open the color palette. You can choose ENVI, System, or pre-defined Custom colors in the Standard tab, or select the Custom tab on the color palette to create a custom color.
-
To define a class, either:
- In the Scatter Plot, left-click and drag to draw a polygon. Pixels that have the same value as the those in the drawn polygon appear in the Scatter Plot and the view in the class color.
- In the view, right-click and select Cursor Mode > Region of Interest. Use the cursor to draw a region in the view, then double-click to accept the polygon. Pixels that have the same value as the those in the drawn polygon appear in the Scatter Plot and view in the class color.
To create a custom class color:
- In the Custom tab, use the color space table to select a color, or enter R,G,B or H,S,L values in the fields provided.
- Use the slider below the color space table to adjust the color gradient.
- Click OK to add the new color to the Custom colors section on the Standard tab.
To clear, reset, or delete a class:
- To clear the Scatter Plot and view of the selected class definition, right-click in the Scatter Plot or view and select Clear Class. To clear the definitions for all classes, right-click the Scatter Plot and select Clear All. All polygons and ROIs used to define the classes will be cleared. The color and name assigned to the classes will not be changed.
- To remove all defined classes and reset the Scatter Plot Tool to its original state, right-click in the Scatter Plot and select Reset Classes. This removes all classes except Class 1 and clears all class definitions.
- To delete the selected class and all of its records, click the Delete Class button . To delete all classes and their records, click the Delete All Classes button .
Set Band Resolution
To set the band resolution in the scatter plot, select Options > Band Resolution, then select one of the following:
-
Adaptive: Reads the data from a resampled pyramid level depending on the spatial size of the band.
-
Full: Reads the data at full resolution, no matter how large the band might be.
Selecting Full on a very large image could slow scatter plot performance. For the best interactive performance, use Adaptive.
Export the Scatter Plot
You can save the Scatter Plot window as an image, PDF, PostScript, and PowerPoint file. You can print the Scatter Plot, and you can copy the plot to the clipboard and paste it into another application. To use these options, select File > Save Plot As > option from the Scatter Plot Tool menu bar. How to use each option is described below.
Image File
Saves the plot to an image file in PNG, JPG, TIF, GIF, or BMP format.
- Select File > Save Plot As > Image File from the Scatter Plot Tool menu bar. The Please Select a File for Writing dialog appears.
- The default filename and format is
envi_plot.png
. Change the filename and file type as needed, then click Save.
Saves the plot to a PDF file.
- Select File > Save Plot As > PDF from the Scatter Plot Tool menu bar. The Please Select a File for Writing dialog appears.
- The default filename is
envi_plot.pdf
. Change the filename as needed, then click Save.
PostScript
Saves the plot to a PostScript file. Enter a filename for the .eps
file, then click Save.
- Select File > Save Plot As > PostScript from the Scatter Plot Tool menu bar. The Please Select a File for Writing dialog appears.
- The default filename is
envi_plot.eps
. Change the filename as needed, then click Save.
Copy
Copies the plot to the clipboard so it can be pasted into another application. To copy the plot to the clipboard, select File > Save Plot As > Copy from the Scatter Plot Tool menu bar.
Prints the plot to the selected printer. Select File > Save Plot As > Print from the Scatter Plot Tool menu bar to get the standard Print dialog.
PowerPoint
Creates a PowerPoint slide with an image of the current plot. Select File > Save Plot As > PowerPoint from the Scatter Plot Tool menu bar. The plot opens in PowerPoint.
Tip: Making the plot window as large as possible will improve the quality of the image inserted into PowerPoint.
Compute Class Statistics
You can calculate class statistics for one class or all classes, including:
- Pixel count and percentage per class.
- Basic statistics (minimum, maximum, mean, and standard deviation) for single- or multi-band images.
- Histograms (frequency distributions) for single- or multi-band images.
For details, see Class Statistics.