KristofferC / PGFPlotsX.jl

Plots in Julia using the PGFPlots LaTeX package
Other
301 stars 40 forks source link

Support for PlotUtils colormaps? #147

Open asinghvi17 opened 5 years ago

asinghvi17 commented 5 years ago

It would be really nice if there was support for JuliaPlots/PlotUtils.jl colormaps in PGFPlotsX.

PlotUtils uses the ColorGradient construct, which is essentially an Array{RGBA{N0f8}, 1} with some length n. I don't have too much experience with translation of colormaps to PGFplots but the manual doesn't make it seem too hard.

KristofferC commented 5 years ago

You can use Colors colormap (https://kristofferc.github.io/PGFPlotsX.jl/stable/examples/juliatypes/#Colormap-1) so adding for ColorGradient shouldn't be hard.

asinghvi17 commented 5 years ago

From Slack, this seems like the place to start - https://github.com/KristofferC/PGFPlotsX.jl/blob/master/src/requires.jl . I will link the PR when it's up, thanks!

BeastyBlacksmith commented 4 years ago

There is an implementation for this in Plots.jl

function pgfx_colormap(grad::ColorGradient)
    join(map(grad.colors) do c
        @sprintf("rgb=(%.8f,%.8f,%.8f)", red(c), green(c), blue(c))
    end,"\n")
end