【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.14.1.4 dataplot_set_colormap
Contents
Description
Set Colormap for a contour plot or any plot that supports a colormap
Syntax
int dataplot_set_colormap( DataPlot & dp, const vector<double> & vZLevels, const vector<uint> & vnFillColors, uint ncAbove = SYSCOLOR_GRAY, uint ncBelow = SYSCOLOR_BLACK, int nModifyContourLines = -1, int nLogScale = -1, const vector<uint> & vnLineColors = NULL, const vector<uint> & vnLineStyles = NULL, const vector<double> & vLineThickness = NULL )
Parameters
- dp
- [input] the data plot to set colormap
- vZLevels
- [input] Z range levels.
- vnFillColors
- [input] Z level corresponding colors. First color is used between first and second levels, and so on. So must follow vnColors.GetSize() = vLevels.GetSize() - 1.
- ncAbove
- [input] color to be used above the last level in vzLevels
- ncBelow
- [input] color to be used below vzLevels
- nModifyContourLines
- [input] 1 means set contour line, 0 for not, -1 means no change as default
- nLogScale
- [input] 1 means Logarithmic, 0 for linear, -1 means no change as default
- vnLineColors
- [input] Z level corresponding contour line colors, the vector size should follow vnLineColors.GetSize() = vLevels.GetSize() - 1
- vnLineStyles
- [input] Z level corresponding contour line styles, the vector size should follow vnLineStyles.GetSize() = vLevels.GetSize() - 1
- vLineThickness
- [input] Z level corresponding contour line thickness, the vector size should follow vnLineThickness.GetSize() = vLevels.GetSize() - 1
Return
return 0 for success, otherwise return -1 if dp invalid, or -3 if dp does not support colormap, or -2 if vzLevels and vnColors are not proper size, or -4 if SetColormap call failed for unknown reasons.
Examples
EX1
// set fill color with Z range levels //For this example to run, an active graph layer with at least one dataplot must exist in the project void dataplot_set_colormap_ex1() { GraphLayer gl = Project.ActiveLayer(); DataPlot dp = gl.DataPlots(0); if(dp) { vector vLevels = {-3, 0, 3}; vector<uint> vnColors = {SYSCOLOR_GREEN, SYSCOLOR_BLUE}; if( 0 != dataplot_set_colormap(dp, vLevels, vnColors) ) out_str("Fail to set colormap"); } }
EX2
// set fill color and lines with Z range levels //For this example to run, an active graph layer with at least one dataplot must exist in the project void dataplot_set_colormap_ex2() { GraphLayer gl = Project.ActiveLayer(); DataPlot dp = gl.DataPlots(0); if(!dp) return; vector vLevels; BOOL bLogScale = false; dp.GetColormap(vLevels, bLogScale); // change the number of Z levels to 5 double dMin = vLevels[0]; double dMax = vLevels[vLevels.GetSize()-1]; int nNewSteps = 5; vLevels.Data(dMin, dMax, (dMax - dMin)/(nNewSteps-1)); vector<uint> vnFillColors = {SYSCOLOR_GREEN, SYSCOLOR_BLUE, SYSCOLOR_CYAN, SYSCOLOR_MAGENTA}; vector<uint> vnLineColors = {SYSCOLOR_YELLOW, SYSCOLOR_DKYELLOW, SYSCOLOR_NAVY, SYSCOLOR_PURPLE}; // line styles vector<uint> vnStyles(vnLineColors.GetSize()); vnStyles = 2; // Dot // line thickness vector vThickness(vnLineColors.GetSize()); vThickness = 2.0; if( 0 != dataplot_set_colormap(dp, vLevels, vnFillColors, SYSCOLOR_GRAY, SYSCOLOR_BLACK, -1, -1, vnLineColors, vnStyles, vThickness) ) out_str("Fail to setup colormap"); }
Remark
See Also
Header to Include
origin.h