Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for PlotUtils colormaps? #147

Open
asinghvi17 opened this issue May 7, 2019 · 3 comments
Open

Support for PlotUtils colormaps? #147

asinghvi17 opened this issue May 7, 2019 · 3 comments

Comments

@asinghvi17
Copy link
Contributor

asinghvi17 commented May 7, 2019

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
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants