Skip to content

Conversation

@Da-Be-Ru
Copy link
Member

One use case I have run into several times now is the need to customize cell and boundary region colormaps for the gridplot call.

Since I didn't see any way to make this happen so far, I would propose adding new default keyword arguments and alter the gridplot routines so they don't use the hard-coded colormap from GridVisualizeTools.jl.

I also altered the 2d gridplot example in the docs to showcase this capability to the user.

@j-fu
Copy link
Member

j-fu commented Jan 19, 2026

Great idea!

Two issues here:

  • Are you sure that this works for all backends ? GridVisualizeTools.bregion_cmap returns a Vector{Colortypey.RGB}. I think backends should be able to assume that this is the case. See GridVisualizeTools.rgbcolor for the way Symbols are transformed to RGB. OTOH we could pass the vector through GridVisualizeTools.rgbcolor in those backends which need this, as we do e.g. with linecolor ... indeed, I think this would be better....

  • May be passing a vector of colors instead of a function would be the more intutive API. We could have an internal wrapper function like this:

function bregioncmap(ctxcmap, ncolors)
   if ctxcmap==nothing
     return bregion_cmap(ncolors)
     else
   return GridvisualizeTools.rgbcolor.(ctxcmap)
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants