Use the RampColors and RampSubset requests

Last Published: April 25, 2020


The following script demonstrates how to color a 10 class legend with 0 - 5 as a Red to White ramp, and 5 - 10 as a White to Blue ramp.



'-- multi_ramp_colors_legend.ave
'-- This script assumes that you have a theme with a
'-- NUMERIC field called "Sumblkpop" in View1.
'-- You should substitute your NUMERIC field name for fname.
theTheme = theView.GetActiveThemes.Get(0)
theFTab = theTheme.GetFTab
f = theFTab.FindField(fname)
theLegend = theTheme.GetLegend
'-- You will need to change the number of quantiles.
'-- This script sets it to 10.
thesymList = theLegend.getsymbols
'-- If you do not like the desired colors for the
'-- Begin and End of the RampColors you will have to
'-- specify one of the preset colors (ie. White, Green, Black, etc.
'-- or define your own color with the Make and SetRGBList
'-- commands. Note how the RampColors goes from Red to Blue;
'-- if you were to eliminate the 2 RampSubset
'-- requests below you would just get one color ramp.
theSymList.rampcolors(Color.GetRed, Color.GetBlue)
'-- You need to specify the a Middle color for the RampSubset.
theMiddleSym = theSymList.Get(4)
'-- The mini Ramps go from Red to White 'RampSubset(0,4)'
'-- and White to Blue 'RampSubset(4,9)'.
'-- Note: If you were to only specify one of the RampSubsets
'-- you would find that the rest of the RampColors request
'-- above (Red to Blue) would still be in effect for those
'-- symbols outside of the RampSubset.
'-- End of multi_ramp_colors_legend.ave

Article ID:000003517

  • Legacy Products

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options