5

What kind of RGB color space is used by Matplotlib? I am especially interested, whether it is sRGB.

Matlab definition of RGB:

RGB and RGBA are sequences of, respectively, 3 or 4 floats in the range 0-1.

abukaj
  • 2,582
  • 1
  • 22
  • 45

2 Answers2

2

Matplotlib is at the time of this writing not colour managed so the current working RGB colourspace will be whatever you have chosen to encode your RGB values, e.g. ACES2065-1, BT.2020, ProPhoto RGB or most likely sRGB. Keep in mind though that some resources, e.g. Viridis, were created with sRGB as a working space in mind.

Kel Solaar
  • 3,660
  • 1
  • 23
  • 29
1

sRGB is the default colour space of PC computers (and for Web). So you can assume that space. On the other hand, there is no hard written specification. Matlab uses mostly numbers, so it is up to you how to interpret the numbers. Not different of solving equation where you (implicitly) have the units.

If you handle colour in a precise way (e.g. transforming data from a colour space to an other), usually you must specify the two spaces.

If you want to save an image not in sRGB, you should specify the colour space (ICC headers). Do no expect you or other people could see the image correctly (if it happens, they could not navigate internet with photo with real colours).

On graphs, "red" is red independently of (most common colour space). It could have a different shade, but usually it doesn't matter (if it is consistent with legend).

Note: in reality you never have sRGB on inputs and outputs, but it is a good approximation for most of people.

Giacomo Catenazzi
  • 8,519
  • 2
  • 24
  • 32
  • How far from sRGB are real outputs? What I am trying to do is to make my plots as "colourblind friendly" as possible. The case of "red" you mentioned is especially problematic, as `sRGB(#FF0000)` is black for most people with impaired colour perception - thus I want to use "vermilion" (`sRGB(#D55E00)`) instead. But if the output is far from sRGB, then my whole effort would be in vain. – abukaj Aug 07 '19 at 14:41
  • People (and colour blind people) uses sRGB screens. If they uses wide gamut screen, they know, and they know how to change the colour space (one cannot browse internet with wide-gamut) [wide-gamut is for professional in visual arts, and with screen calibrated often]. Tip: uses already made up colour scales, you probably do not need to have precise colours (this not just for colour blind people, but for all humans [we can see yellow, we cannot see yellow points in graphs). If you do colour management, you should set it to "Saturation intent". – Giacomo Catenazzi Aug 07 '19 at 14:59
  • Actually, I am experimenting with [CUD colour pallet](https://jfly.uni-koeln.de/color/#pallet). – abukaj Aug 07 '19 at 15:44