I am using MacOS. I have been a long-time PyPlot user and I want to switch to Plots.jl
My setup is using vim and julia REPL in a terminal side-by-side.
I have the following set of very basic questions:
-
When I use pgfplots, it opens inkscape within XQuartz to display plots. Is there a better/quicker interface? Inkscape is great for vector editing of plots, but for most of my usage, I just want something where I can zoom in, look at stuff and save to pdf/svg for including in Latex document later. I was looking into tikzit, but I don’t know how to switch the display to tikzit in julia. TLDR: How to switch interface from inkscape to anything else in Plots.jl, and interface suggestions for that ‘anything else’.
-
I have this kind of preamble for plotting:
function makePlot(x,y)
plot(framestyle=[:box, :grid], size=(800,600))
plot!(x,y,label=:"Label", lc=:red)
xaxis!("xlabel")
yaxis!("ylabel")
title!("title")
savefig(string(path, "fig1.pdf"))
end
How to have a scatter and line plot together in julia? Python has a parameter in plt.plot where you can specify linestyle as plt.plot(x,y, 'ko-')
. In julia, the only attributes are Symbol[:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
. I’ve been using plot!(x,y); scatter!(x,y)
together to circumvent this problem.
and
using framestyle throws the following error with pgfplots:
Error showing value of type Plots.Plot{Plots.PGFPlotsBackend}:
ERROR: MethodError: no method matching pgf_framestyle(::Array{Symbol,1})
Closest candidates are:
pgf_framestyle(::Symbol) at /Users/prithvithakur/.julia/packages/Plots/oiirH/src/backends/pgfplots.jl:62
Stacktrace:
[1] pgf_axis(::Plots.Subplot{Plots.PGFPlotsBackend}, ::Symbol) at /Users/prithvithakur/.julia/packages/Plots/oiirH/src/backends/pgfplots.jl:322
[2] _update_plot_object(::Plots.Plot{Plots.PGFPlotsBackend}) at /Users/prithvithakur/.julia/packages/Plots/oiirH/src/backends/pgfplots.jl:446
[3] prepare_output(::Plots.Plot{Plots.PGFPlotsBackend}) at /Users/prithvithakur/.julia/packages/Plots/oiirH/src/plot.jl:273
[4] display(::Plots.PlotsDisplay, ::Plots.Plot{Plots.PGFPlotsBackend}) at /Users/prithvithakur/.julia/packages/Plots/oiirH/src/output.jl:142
[5] display(::Any) at ./multimedia.jl:287
[6] #invokelatest#1 at ./essentials.jl:742 [inlined]
[7] invokelatest at ./essentials.jl:741 [inlined]
[8] print_response(::IO, ::Any, ::Any, ::Bool, ::Bool, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:155
[9] print_response(::REPL.AbstractREPL, ::Any, ::Any, ::Bool, ::Bool) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:140
[10] (::getfield(REPL, Symbol("#do_respond#38")){Bool,getfield(REPL, Symbol("##48#57")){REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:714
[11] #invokelatest#1 at ./essentials.jl:742 [inlined]
[12] invokelatest at ./essentials.jl:741 [inlined]
[13] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/LineEdit.jl:2273
[14] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:1035
[15] run_repl(::REPL.AbstractREPL, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:192
[16] (::getfield(Base, Symbol("##734#736")){Bool,Bool,Bool,Bool})(::Module) at ./client.jl:362
[17] #invokelatest#1 at ./essentials.jl:742 [inlined]
[18] invokelatest at ./essentials.jl:741 [inlined]
[19] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:346
[20] exec_options(::Base.JLOptions) at ./client.jl:284
[21] _start() at ./client.jl:436
- Last question, how to change the grid density in
framestyle[:grid]
?
Thanks for all the help!