-
Notifications
You must be signed in to change notification settings - Fork 89
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
plot_surface and facecolors #91
Comments
I agree that using |
Good to know. Thank you. |
Finding this saved my life. I spent hours trying to get the colormap to work, and couldn't figure out how to use it. Could this be added to the documentation, or to this recordnotfound page, which has the most amount of detail on colormaps, or to the README of this project? Thanks! |
@gozzilli, in Julia 0.4 the |
Hello, For example, I used this:
because a direct call throws an error:
I get a similar error for the suggestion made here. |
I can't reproduce: julia> using PyPlot; c = get_cmap("RdBu")
ColorMap "RdBu"
julia> c(0.5)
(0.9657054999295402,0.9672433698878569,0.968089198364931,1.0)
julia> [c(x) for x in linspace(0,1,10)]
10-element Array{Any,1}:
(0.40392157435417175,0.0,0.12156862765550613,1.0)
(0.711880063309389,0.12179931034060085,0.1816993519371631,1.0)
(0.8622837452327504,0.4295271150037354,0.3427143558567646,1.0)
(0.9686274528503418,0.7176470756530762,0.6000000238418579,1.0)
(0.9820069214876961,0.9061899325426888,0.861591703751508,1.0)
(0.8838908181470984,0.928489046938279,0.9530180727734285,1.0)
(0.6549019813537598,0.814379096031189,0.8941176533699036,1.0)
(0.3234909813778073,0.6149173624375287,0.7854671408148373,1.0)
(0.14248366800009035,0.4173010459133223,0.6833525755826164,1.0)
(0.019607843831181526,0.1882352977991104,0.3803921639919281,1.0) |
Maybe you need a |
|
Apparently, the
cmap
keyword inplot_surface
colors the surface in the Z direction. I needed to color the surface of a sphere with a scalar function. This is achieved with thefacecolors
keyword. In Matplotlib this is the solution:However, in
PyPlot.jl
theColorMap
type does not have a method that takes an array of floats and returns the associated colors in the colormap. The workaround isSomething similar happens with
matplotlib.colors.Normalize
. As a result, inPyPlot.jl
thefacecolors
keyword must have the valueI am new to Julia and don't have the skills (yet) to submit a pull request fixing this. Hopefully it won't be difficult to implement.
The text was updated successfully, but these errors were encountered: