rgb2cm - Fix RGB color data in Painter's mode
Painter's mode rendering is required for copying a figure to the clipboard as an EMF (vector format) or printing to vector-format files such as PDF and EPS. However, if the colours of any patches in your figure are represented using CData and an RGB colour code, these will not show in the copied figure. You may also get a warning like:
Warning: RGB color data not yet supported in Painter's mode
The solution is to change these specific patches to use an index into the colormap. That's what this script does. For each patch using RGB, it adds those colours to the colormap and changes the patch to use a colormap index.
Cite As
Robbie Andrew (2026). rgb2cm - Fix RGB color data in Painter's mode (https://www.mathworks.com/matlabcentral/fileexchange/35469-rgb2cm-fix-rgb-color-data-in-painter-s-mode), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Graphics > Labels and Styling > Interactions, Camera Views, and Lighting > Lighting, Transparency, and Shading >
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
