JBar
JBar

Reputation: 145

custom colorgradient heatmap in Julia

I am currently using the Plots package and have it along with the PyPlot packages installed. With the code

using Plots
y = rand(10, 10)
pyplot()
plt = plot(y, st=:heatmap, clim=(0,1), color=:coolwarm, colorbar_title="y")

I am able to produce this heat map

My question is how I can change the color gradient from its current setting (coolwarm which corresponds with a transition from red to gray to blue) to a new setting which has a gradient from red to green to blue. Is there some way to create a custom colorgradient and use that as an argument where I have 'coolwarm' in my sample code?

Upvotes: 9

Views: 5151

Answers (1)

Michael K. Borregaard
Michael K. Borregaard

Reputation: 8044

Yes. First of all there are numerous color libraries in Plots. Try clibraries(), then e.g. cgradients(:colorbrewer) or showlibrary(colorbrewer). In addition, you can make your own gradient with e.g. cgrad([:red, :green, :blue]) and pass that as the color argument.

Upvotes: 7

Related Questions