julia-plot
julia-plot copied to clipboard
syntax error: malformed function arguments
Just came across this plotting library for julia. After downloading the source and trying to load the source (plot.j) into julia I get this error
julia> load("../julia-plot/plot.j") syntax error: malformed function arguments (tuple (call generate_data (ref fun 1) xmin xmax (. pl 'plot_points)) (ref fun 2)) in load_now at util.jl:231 in load_now at util.jl:245 in require at util.jl:174 at /Users/roger/source/julia-plot/plot.j:112 in load_now at util.jl:231 in load_now at util.jl:245 in require at util.jl:174 in load_now at util.jl:256 in require at util.jl:174
I'm very new to julia, so I'm not able to determine how the problem can be fixed. Could be a very simple issue. Anyway, thanks for putting this together.
PS. I'm using Julia version 0.0.0+100859992.r63e9
I'm afraid this code is quite old, so Julia has probably changed a lot in the meantime. I haven't used Julia since I wrote this, so I might not be up to date.
That said, it looks like the syntax for list comprehensions has changed - the error is related to this line:
data = [ (generate_data(fun[1], xmin, xmax, pl.plot_points), fun[2]) | fun=pl.funs]
I'm a bit short on time atm, but maybe I'll be able to look into it this week.
Hi, Thanks for the quick reply. After looking through the code I managed to fix the issue. However, another issue arose, related to the add function. By the way, do you have any future plans for this library? I just started using julia, and coming from python I must say that one of the major obstacles for my spending more time exploring julia is the lack of plotting. I know there are other plotting packages out there; among them an interface to gnuplot. I think it would be nicer, though, to have something similar to matplotlib for python. Anyway, here's the error I get after fixing the list comprehension syntax
julia> plot(x -> sin(x), -4,4,"test.png") no method promote_type(AbstractKind,(CompositeKind,CompositeKind)) in method_missing at base.jl:70 in cat at abstractarray.jl:595 in add at /Users/roger/source/julia-plot/plot.jl:100 in plot at /Users/roger/source/julia-plot/plot.jl:182
I understand if you don't have much time to look into this, but if you have any idea how to get it working, I'd be very grateful.
On Sun, Nov 4, 2012 at 11:02 PM, Julian Schrittwieser < [email protected]> wrote:
I'm afraid this code is quite old, so Julia has probably changed a lot in the meantime. I haven't used Julia since I wrote this, so I might not be up to date.
That said, it looks like the syntax for list comprehensions has changed - the error is related to this line:
data = [ (generate_data(fun[1], xmin, xmax, pl.plot_points), fun[2]) | fun=pl.funs]
I'm a bit short on time atm, but maybe I'll be able to look into it this week.
— Reply to this email directly or view it on GitHubhttps://github.com/Mononofu/julia-plot/issues/1#issuecomment-10051314.
~ Roger
Yes, that was also my main motivation in writing this library. However, I've since moved back to Python, as the general library ecosystem is just so much better, and Julia as a language just didn't feel ready.
I think the error you are seeing here is due to problems with the Julia type system - one of the major reasons why I stopped using the language. I don't know if they've fixed it in the meantime - you might get a good answer by asking in #julia on freenode.
Basically, this line of code plot.funs = cat(1, plot.funs, [(fun, color)])
is trying to append the (function, color) tuple to the list of functions that are already in the plot. For some reason, it then fails to convert the type of the tuple to Any
(the type of funs list)
Hi, Yes, I'm quite attached to the python/numpy/scipy/matplotlib toolchain as well, and I have no immediate plans of switching to julia completely. However, I find it an intriguing project and I would like to learn julia well enough to make it a useful supplementary tool. I particularly find the built-in parallel processing capabilities to be interesting; that's something I find lacking in python. In any case, I'll let you know if I find a solution to the problem. Thanks again!
On Sun, Nov 4, 2012 at 11:24 PM, Julian Schrittwieser < [email protected]> wrote:
Yes, that was also my main motivation in writing this library. However, I've since moved back to Python, as the general library ecosystem is just so much better, and Julia as a language just didn't feel ready.
I think the error you are seeing here is due to problems with the Julia type system - one of the major reasons why I stopped using the language. I don't know if they've fixed it in the meantime - you might get a good answer by asking in #julia on freenode.
Basically, this line of code plot.funs = cat(1, plot.funs, [(fun, color)])is trying to append the (function, color) tuple to the list of functions that are already in the plot. For some reason, it then fails to convert the type of the tuple to Any (the type of funs list)
— Reply to this email directly or view it on GitHubhttps://github.com/Mononofu/julia-plot/issues/1#issuecomment-10051508.
~ Roger
@grero There is already in Julia a library called PyCall, you can use for import Python libraries and using it on Julia. There is an example using matplotlib ;)