Another quick solution is to just create an array/tuple that PyPlot will
recognize as an RGB array/tuple:

myColors = distinguishable_colors(N)
PyPlot_myColors = [[red(i), green(i), blue(i)] for i in myColors]

You can also save yourself the time from needing to call the new color
scheme for every plot by redefining the color cycle:

ax[:set_color_cycle](PyPlot_myColors)



Gabriel Gellner wrote
> I use the following as a utility to have PyPlot.jl/PyCall.jl automatically 
> convert RGB types into tuples
> 
> function PyObject(t::Color)
>     trgb = convert(RGB, t)
>     ctup = map(float, (red(trgb), green(trgb), blue(trgb)))
>     o = PyObject(ctup)
>     return o
> end
> 
> I'm sure it can be tweaked to be more general. But it works so far when I 
> am doing quick and dirty plotting :) Good luck!
> 
> On Thursday, July 7, 2016 at 6:09:41 PM UTC-7, Tim Holy wrote:
> 
>> On Thursday, July 7, 2016 4:41:10 PM CDT Islam Badreldin wrote: 
>> > Maybe 
>> > this means PyPlot.jl needs to add better support for ColorTypes? 
>>
>> That sounds like a very reasonable solution. I don't really know PyPlot
>> at 
>> all, so I don't have any advice to offer, but given how well you seem to 
>> understand things already it seems that matters are in excellent hands 
>> :-). 
>>
>> Best, 
>> --Tim 
>>
>>





--
View this message in context: 
http://julia-programming-language.2336112.n4.nabble.com/Converting-from-ColorTypes-to-Tuple-tp43674p44391.html
Sent from the Julia Users mailing list archive at Nabble.com.

Reply via email to