jmcnamara / XlsxWriter

A Python module for creating Excel XLSX files.
https://xlsxwriter.readthedocs.io
BSD 2-Clause "Simplified" License
3.66k stars 631 forks source link

feature request: conditional formatting 2_color_scale supporting non-contiguous ranges #1065

Closed ismaelresp closed 7 months ago

ismaelresp commented 7 months ago

Feature Request

For example: worksheet1.conditional_format('$B$3:$B$14,$C$4:$C$14',{'type': '2_color_scale','min_color': '#FFFFFF', 'max_color': '#999999'})

Useful for color scaling a symmetric matrix cut in half because showing the whole matrix is redundant. For example, a matrix of distances.

jmcnamara commented 7 months ago

You are in luck. That feature is already there via the multi_range option: https://xlsxwriter.readthedocs.io/working_with_conditional_formats.html#multi-range

ismaelresp commented 7 months ago

It works! Many thanks.