Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I wrote this function to make a ListPlot where the points are colored by a third argument.

ColorListPlot[triples_, options : OptionsPattern[]] := ListPlot[
  Transpose[{triples[[All, {1, 2}]]}],
  PlotStyle -> (ColorData["Rainbow"] /@ Rescale[triples[[All, 3]]]),
  PlotLegends -> BarLegend[{"Rainbow", Quantile[triples[[All, 3]], {0, 1}]}],

Note that using OptionsPattern I have enabled this to accept options and pass them along to ListPlot.

Now I'd like to label that legend using LegendLabel. If I pass a LegendLabel option to ColorListPlot it will end up being given to ListPlot. How can I modify the function so that the a LegendLabel option is passed to BarLegend and all other options end up in ListPlot?

share|improve this question
Check FilterRules[rules,Except[patt]] –  belisarius Jan 5 '13 at 23:19
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.