plt.contourf equivalent in PyPlot.jl

209 views
Skip to first unread message

Lex

unread,
Dec 17, 2015, 1:11:50 AM12/17/15
to julia-users
Hello,

What is the correct way to create contour plot using PyPlot.jl? .. like in Python we have, 

plt.contourf(xx, yy, Z, cmap=plt.cm.Spectral, alpha=0.8)

in Julia I tried the following:

fig = figure("plot")
ax = fig[:add_subplot]
ax[:contour](grid_x, grid_y, zz, linewidth=0.0) 

but is getting the following error:

LoadError: KeyError: contour not found
while loading In[57], in expression starting on line 3

Any help is appreciated. Thanks.

cdm

unread,
Dec 17, 2015, 3:38:22 AM12/17/15
to julia-users

there was an issue related to contourf() that was fixed about three weeks back:



if you have not run Pkg.update() since this fix, then you may be experiencing
this issue or something closely related.

Steven G. Johnson

unread,
Dec 17, 2015, 12:53:32 PM12/17/15
to julia-users


On Thursday, December 17, 2015 at 1:11:50 AM UTC-5, Lex wrote:
Hello,

What is the correct way to create contour plot using PyPlot.jl? .. like in Python we have, 

plt.contourf(xx, yy, Z, cmap=plt.cm.Spectral, alpha=0.8)

contourf(xx, yy, Z, cmap=get_cmap("Spectral"), alpha=0.8) 

(In PyPlot, most of the matplotlib.pyplot functions are simply exported into the global namespace if you do "using PyPlot", in Julia style.)

Lex

unread,
Dec 17, 2015, 1:37:33 PM12/17/15
to julia-users
Thanks a lot, Steven.
Reply all
Reply to author
Forward
0 new messages