# Using Plots.jl with pgfplots() backend

**URL:** <https://discourse.julialang.org/t/using-plots-jl-with-pgfplots-backend/29740>\
**Category:** New to Julia\
**Tags:** plotting, pgfplot\
**Created:** [October 10, 2019, 6:32pm UTC](https://discourse.julialang.org/t/using-plots-jl-with-pgfplots-backend/29740 "2019-10-10T18:32:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thehalfspace](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thehalfspace/32/7217_2.png) [@thehalfspace](https://discourse.julialang.org/u/thehalfspace)\
**Post date:** [October 10, 2019, 6:32pm UTC](https://discourse.julialang.org/t/using-plots-jl-with-pgfplots-backend/29740/1 "2019-10-10T18:32:06Z")

</div>

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:

1. 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’.**

2. I have this kind of preamble for plotting:

```julia
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:

```julia
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

```

1. Last question, how to change the grid density in `framestyle[:grid]`?

Thanks for all the help!

---

<div class="post-metadata">

**Author:** ![thehalfspace](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thehalfspace/32/7217_2.png) [@thehalfspace](https://discourse.julialang.org/u/thehalfspace)\
**Post date:** [October 14, 2019, 8:24pm UTC](https://discourse.julialang.org/t/using-plots-jl-with-pgfplots-backend/29740/2 "2019-10-14T20:24:27Z")

</div>

using `plot(framestyle=(:box))` instead of `plot(framestyle=[:box])` solves one of the problems. I still don’t know how to include minorgrids.
