Is there a way to map an existing row in a numpy array with 3 RGB chars or do I have to convert it to a “#hex-triple” color string first?
I have to do this, for example:
colors = [’#{0:0>2x}{0:0>2x}{0:0>2x}’.format(int(i)) for i in np.nditer(data)]
when, I’d rather just do:
colors = np.concatenate([data, data, data], axis=1)
(or some bit packing magic if it just wants a 32-bit int)
I’ve tried the latter, but it doesn’t seem to do anything, and I haven’t dug into the code yet. All code examples show the stringified version.
Hi Jon,
Sorry for the late answer.
We actually support colors in “named colors”, hex values, rgb 3-tuples and 4-tuples.
Can you provide a complete example so we can actually see where is the problem?
I guess it is probably something easy to fix regarding as how you are passing the tuple list/array.
Damian
···
On Tuesday, December 2, 2014 1:20:23 PM UTC-3, Jon Woodring wrote:
Is there a way to map an existing row in a numpy array with 3 RGB chars or do I have to convert it to a “#hex-triple” color string first?
I have to do this, for example:
colors = [‘#{0:0>2x}{0:0>2x}{0:0>2x}’.format(int(i)) for i in np.nditer(data)]
when, I’d rather just do:
colors = np.concatenate([data, data, data], axis=1)
(or some bit packing magic if it just wants a 32-bit int)
I’ve tried the latter, but it doesn’t seem to do anything, and I haven’t dug into the code yet. All code examples show the stringified version.
I also had a similar issue. I tried passing rgb tuple values, and always end up with a grey line.
For example
color = tuple([255,0,255])
Based upon this chart it should be bright pink. I’ve used these same values with matplotlib and didn’t seem to run into any issues. Is there a particular syntax to be used?
Thanks
···
On Friday, December 12, 2014 at 12:20:34 PM UTC-8, Damian Avila wrote:
Hi Jon,
Sorry for the late answer.
We actually support colors in “named colors”, hex values, rgb 3-tuples and 4-tuples.
Can you provide a complete example so we can actually see where is the problem?
I guess it is probably something easy to fix regarding as how you are passing the tuple list/array.
Damian
On Tuesday, December 2, 2014 1:20:23 PM UTC-3, Jon Woodring wrote:
Is there a way to map an existing row in a numpy array with 3 RGB chars or do I have to convert it to a “#hex-triple” color string first?
I have to do this, for example:
colors = [‘#{0:0>2x}{0:0>2x}{0:0>2x}’.format(int(i)) for i in np.nditer(data)]
when, I’d rather just do:
colors = np.concatenate([data, data, data], axis=1)
(or some bit packing magic if it just wants a 32-bit int)
I’ve tried the latter, but it doesn’t seem to do anything, and I haven’t dug into the code yet. All code examples show the stringified version.