jasongilman / proto-repl-charts

An Atom Plugin extension for Proto REPL that allows displaying graphs.
MIT License
65 stars 4 forks source link

usage with a remote repl? #11

Closed michaellindon closed 7 years ago

michaellindon commented 7 years ago

I am loving proto-repl and proto-repl-charts.

So far the implementation has been seamless and I really want to thank you for making these plugins, they're great.

Currently within the atom editor I am connecting to a remote nrepl server using the Proto repl: Remote Nrepl Connection. This works out great and no problems evaluating lines of code but when I try to plot something for instance:

(proto-repl-charts.charts/line-chart
 "Trigonometry"
 {"sin" (map #(Math/sin %) (range 0.0 6.0 0.2))
  "cos" (map #(Math/cos %) (range 0.0 6.0 0.2))})

I get an error ClassNotFoundException proto-repl-charts.charts java.net.URLClassLoader.findClass (URLClassLoader.java:381)

Is there any reason why plotting with nrepl would not work? As a check I have tried plotting using incanter and the plot shows up fine using that chart library.

jasongilman commented 7 years ago

I'm glad you're enjoying it. Is the Proto REPL charts library included in the application you're connecting to? That's one limitation right now that it uses that code to generate the data that gets returned to display in Atom.

On Oct 27, 2016, at 9:49 PM, michaellindon notifications@github.com wrote:

I am loving proto-repl and proto-repl-charts.

So far the implementation has been seamless and I really want to thank you for making these plugins, they're great.

Currently within the atom editor I am connecting to a remote nrepl server using the Proto repl: Remote Nrepl Connection. This works out great and no problems evaluating lines of code but when I try to plot something for instance:

(proto-repl-charts.charts/line-chart "Trigonometry" {"sin" (map #(Math/sin %) (range 0.0 6.0 0.2)) "cos" (map #(Math/cos %) (range 0.0 6.0 0.2))}) I get an error ClassNotFoundException proto-repl-charts.charts java.net.URLClassLoader.findClass (URLClassLoader.java:381)

Is there any reason why plotting with nrepl would not work? As a check I have tried plotting using incanter and the plot shows up fine using that chart library.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

michaellindon commented 7 years ago

I have

          :dependencies [[org.clojure/clojure "1.8.0"]
                 [proto-repl-charts "0.3.2"]
                 [proto-repl "0.3.1"]])

in my project.clj file. Does the chart functionality require atom? For instance with incanter I can fire up a lein repl and plot something - it will open a new window with the plot using jfreechart.

If I fire up lein repl and then try

(proto-repl-charts.charts/line-chart
 "Trigonometry"
 {"sin" (map #(Math/sin %) (range 0.0 6.0 0.2))
  "cos" (map #(Math/cos %) (range 0.0 6.0 0.2))})

I get the same error message as if id attached the remote repl within atom and tried to execute the code

michaellindon commented 7 years ago

If its not possible to get this to work, are you able to recommend any other charting libraries for clojure that are as good? For me I do a lot of computationally intensive data analysis. I edit my code locally, but then have the remote repl on a more powerful machine to crunch the numbers. I would like to be able to plot results when they are done. Such is my workflow. Would be great to have this functionality with proto-repl-charts

jasongilman commented 7 years ago

Proto REPL charts will work fine over an nREPL connection provided proto-repl-charts.charts is in the classpath. The chart functionality does not depend on Atom with the JVM. The only thing proto-repl-charts.charts does is take the data you give it and convert it into a special format and return it at the REPL. nREPL sends that data back for display as normal but Proto REPL detects that it is different and will display the graph.

You may need to (require 'proto-repl-charts.charts) in your repl session before you execute the code to draw the chart so that Clojure will make the code available. I just realized that's probably the issue you're running into.

michaellindon commented 7 years ago

It worked, amazing!! thank you :+1:

jasongilman commented 7 years ago

That's great.