I am new to Julia and tried to plot the gradient field of a loss function. I can get the lengths of the arrows by norm(dx, dy). But I don’t know how to convert a vector of values (lengths) into a vector of colors or how to specify a color based on a value.
My plot order looks like this:
""pl=quiver(Kp_plot, Ki_plot, quiver=(grad_Kp, grad_Ki), xlims=(Kp_plot,Kp_plot[end]) ,ylims=(Ki_plot,Ki_plot[end]) “”
It looks nice but the color doesn’t seem to be strictly related to the length of the arrows. I have no idea why. The ones in the middle are the shortest and therefor should be less bright than the upper ones.
GR seems to not support the arrow series type so they draw the arrows using the shape series type.
If you want to customize it you could also plot other shapes using that method.
This would explain the multiple color values.
I gave my example another try with as many lengths as arrows. And it worked out after all ! Now I only have to change the sombreros. But I’m already delighted. I couldn’t have done that without your help!