On Friday, April 3, 2015 at 11:05:16 AM UTC-4, Anders Madsen wrote: > > I am using IJulia. > I want to construct my own colormaps.. > > when I load PyPlot (with: using PyPlot) the funcstion ListedColormap is > not available > > when I try to load matplotllib.colors which owns the function, with import > matplotlib.colors I get the message that import is a syntax error. >
After you type "using PyPlot", the matplotlib module is already loaded and is stored in the global variable "matplotlib". To get the function you want, just call: matplotlib[:colors][:ListedColormap](.........) In particular, note that where you would have foo.bar in Python, you type foo[:bar] in Julia (because Julia does not currently allow PyCall to overload the "."). See the PyCall documentation. "import matplotlib" will not work in any case, because "import" imports Julia modules and "matplotlib" is a Python module. You would do "using PyCall" and the "@pyimport matplotlib". However, this is not necessary since PyPlot already loads the matplotlib module as mentioned above.
