simple example using Plots following with warnings and an error


#1

I am using Julia 0.6.2 (Windows) and the Atom editor

After launching Julia and

using Plots

I’ve got the following warnings:

WARNING: using Plots.savefig in module Main conflicts with an existing identifier.
WARNING: using Plots.quiver in module Main conflicts with an existing identifier.
WARNING: using Plots.pie in module Main conflicts with an existing identifier.
WARNING: using Plots.barh in module Main conflicts with an existing identifier.
WARNING: using Plots.grid in module Main conflicts with an existing identifier.
WARNING: using Plots.contourf in module Main conflicts with an existing identifier.
WARNING: using Plots.plot in module Main conflicts with an existing identifier.
WARNING: using Plots.spy in module Main conflicts with an existing identifier.
WARNING: using Plots.hexbin in module Main conflicts with an existing identifier.
WARNING: using Plots.scatter in module Main conflicts with an existing identifier.
WARNING: using Plots.bar in module Main conflicts with an existing identifier.
WARNING: using Plots.arrow in module Main conflicts with an existing identifier.
WARNING: using Plots.contour in module Main conflicts with an existing identifier.
WARNING: using Plots.twinx in module Main conflicts with an existing identifier.
WARNING: using Plots.text in module Main conflicts with an existing identifier.
WARNING: using Plots.boxplot in module Main conflicts with an existing identifier.

In a next step I applied the following two lines:

x = 1:10; y = rand(10,2)
plot(x,y,title="Two Lines",label=["Line 1" "Line 2"],lw=3)

and I’ve got the error message:

PyError (ccall(@pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, arg, kw)) <class 'AttributeError'>

What is wrong? Is the PyError related to the above warnings? And how can I overcome these difficulties?


#2

Did you using PyPlot? That would cause such issues since now you’d have a bunch of duplicated plot commands.


#3

thanks for the prompt reply.
No, I am appliedusing Plots. And how can I get rid of the duplicated commands?


#4

Those duplications are because you loaded some other plotting library. PyError likely because it was PyPlot. If you only load Plots.jl then this wouldn’t happen.


#5

I started a fresh Julia session. Within this session the only the module Plots was loaded. Still my question is how to get rid of the duplicated commands?


#6

What’s in your .juliarc file?

You cannot get rid of the duplicated commands until we know where they are coming from. using Plots only runs once, so that’s not what it is. Plots.jl doesn’t have these duplications internally, so in fresh installations with a fresh Julia session this doesn’t pop up. We need to find out what plot commands are added to your environment and causing this. The PyError is really telling because it would only happen if you had some PyCall package and Plots.jl does not come with PyCall, so there is another source here and I cannot debug what’s going on until I know what that is.


#7

You are right:

Here is my juliarc:

Set up environment for Julia Windows binary distribution

ENV["PATH"] = JULIA_HOME*";"*ENV["PATH"]

c:\Users\Carsten\AppData\Local\Julia-0.6.2\etc\julia\juliarc.jl

if isdir(Pkg.dir("PyPlot"))
    @eval using PyPlot
else
    warn("PyPlot not installed")
end 

My question now
how should I change the above lines if I want to use the package Plots

Thanks again for your remarks and the help.


#8

You’ll need to comment out

if isdir(Pkg.dir("PyPlot"))
    @eval using PyPlot
else
    warn("PyPlot not installed")
end 

#9

It works.
Thank you for your assistance.