Again, not sure what plotting package you’re using, but almost all of them will have some way of saving the plots to disk. This is generally not convenient for interactive use, but if you don’t want to use the various gui frontends for displaying plots, you can always save the plots and open them with your preferred image viewer. Depending on how emacs was compiled, you may be able to simply open the image files in a new buffer to view them.
Thanks n-J. I will go back to the docs and see how to save plots.
[update: I tried using png() and savefig() as in the docs but got
‘savefig undefined’ and ‘png undefined’]
Looks to be in the ‘too hard basket’
savefig is a function in Plots, so you need a using Plots
before calling it.
I have used julia to teach a graduate level econometrics course, with students running Windows, Linux and Apple. My recommendation is to work from the REPL, and let students use whatever editor they like. At least, that has worked well for me. It’s simple and relatively error-proof.
Hi Mc. Thanks. I am obviously missing something.
julia> using Plots
julia> plt=plot([0;1;4;9]);
julia> png(“out.png”,plt)
ERROR: MethodError: no method matching png(::String, ::Plots.Plot{Plots.GRBackend})
Closest candidates are:
png(::AbstractString) at /home/davide/.julia/packages/Plots/8GUYs/src/output.jl:10
Stacktrace:
[1] top-level scope at REPL[6]:1
julia> savefig(“out.png”,plt)
ERROR: MethodError: no method matching savefig(::String, ::Plots.Plot{Plots.GRBackend})
Closest candidates are:
savefig(::AbstractString) at /home/davide/.julia/packages/Plots/8GUYs/src/output.jl:129
Stacktrace:
[1] top-level scope at REPL[7]:1
Thanks for any help.
The error message is telling you that you’re calling savefig
wrong - you only need to provide the path argument, and the current figure will be plotted. Alternatively, you can supply the figure you want to plot as the first argument.
Either:
savefig("out.png")
or:
savefig(plt, "out.png")
With these kinds of method errors the docstring is often helpful:
help?> savefig
search: savefig StackOverflowError
savefig([plot,] filename)
Save a Plot (the current plot if plot is not passed) to file. The file type is inferred from the file extension. All
backends support png and pdf file types, some also support svg, ps, eps, html and tex.
Worked! Great!
Update on my experiences (based on help from this forum)
Now after having gotten julia-repl version of Emacs going on both Mac and Linux, I can add a success to JupyterLab as well - with the proviso that the latter interacts badly with some ad-blockers [with some, it is not enough to ‘whitelist’]. JupyterLab appears to have some handy features.