PURPOSE
This app can be used to create a spectrum curve with filled colors defined by wavelength in x data.
INSTALLATION
Download the file Color_Spectrum_Plot.opx, and then drag-and-drop onto the Origin workspace. An icon will appear in the Apps Gallery window.
OPERATION
- Make a worksheet for xy spectrum data or a graph window for spectrum curve active. Click the Color Spectrum Plot icon in the Apps Gallery window. Note that spectrum data's x should represent wavelength and its unit must be nm.
- A dialog will open. Check Smooth sRGB check box, colors for wavelength will be smoothed.
- Click OK button. A color spectrum plot will be created. Area between spectrum curve and x axis will be filled by colors defined by wavelength in x axis. And three columns for plot data are created in a worksheet. The third column includes RGB values for its wavelength in x data. Colors will be set missing values for wavelength outside the range 360nm to 830nm.
Sample OPJU File
This app provides a sample OPJU file. Right click on the Color Spectrum Plot icon in the Apps Gallery window, and choose Show Samples Folder from the short-cut menu. A folder will open. Drag-and-drop the project file ColorSpecPlotEx.opju.opju from the folder onto Origin. The Notes window in the project shows detailed steps.
Note: If you wish to save the OPJU after changing, it is recommended that you save to a different folder location (e.g. User Files Folder).
Algorithm
- Convert wavelength (unit: nm) to CIE 1931 XYZ
In the app's folder, CMF.csv file includes color matching functions (360nm - 830nm) for CIE 1931 2° Standard Observer. Use wavelength in x data to interpolate on color matching functions, and CIE 1931 XYZ values for each x can be calculated. XYZ will be set missing values for wavelength outside the range in the csv file.
- Convert XYZ to sRGB
CIE XYZ can be converted to RGB values by linear transformation. [1] D65 is used for the transformation in this app. Apply gamma correction, and RGB values can be transformed to sRGB. [1]
- Smooth sRGB
Follow the description in reference [2], RGB values are normalized, smoothed and corrected by gamma.
Reference
- sRGB
- Making Color Spectrum Plots