2
$\begingroup$

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}]}],
  options
]

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?

$\endgroup$
1
  • 5
    $\begingroup$ Check FilterRules[rules,Except[patt]] $\endgroup$ Jan 5, 2013 at 23:19

0