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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With