Reputation: 746
I am very new to Julia. I have tried a sample code posted in Julia site which uses Gadfly to demonstrate plotting. However, it gives me the below error. I believe that all the dependent packages were installed.
Code:
Pkg.add("Gadfly")
using Gadfly
draw(SVG("output.svg", 6inch, 3inch), plot([sin, cos], 0, 25))
Error I got is:
ERROR: PyError (:PyObject_Call) <type 'exceptions.ValueError'>
ValueError('third arg must be a format string',)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.py", line 2987, in plot
ret = ax.plot(*args, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/axes.py", line 4137, in plot
for line in self._get_lines(*args, **kwargs):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/axes.py", line 317, in _grab_next_args
for seg in self._plot_args(remaining, kwargs):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/axes.py", line 279, in _plot_args
raise ValueError('third arg must be a format string')
[inlined code] from /Users/mango/.julia/v0.4/PyCall/src/exception.jl:81
in _pycall at /Users/mango/.julia/v0.4/PyCall/src/PyCall.jl:546
in pycall at /Users/mango/.julia/v0.4/PyCall/src/PyCall.jl:568
in plot at /Users/mango/.julia/v0.4/PyPlot/src/PyPlot.jl:395
What is wrong with this sample code?
Upvotes: 1
Views: 507
Reputation: 1332
It indeed appears that the second comment is the issue, however at least in julia version 0.4 if you wish you can have both packages open, you just have to specify which one you are using. So if you have used the commands:
using PyPlot
using Gadfly
draw(SVG("output.svg", 6inch, 3inch), Gadfly.plot([sin, cos], 0, 25))
worked for me. This way you specify that you are using the Gadfly package rather than the PyPlot package for this specific plot
Upvotes: 3