Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

PGFPlotsX - How to save figure?

$
0
0

Hello!

I have some code as:

p = scatter((data[1,id1],data[2,id1]),
            markersize = 3.5,
            markerstrokestyle = :dot,
            aspect_ratio=:equal,
            color = :orange,
            label = "Sick"
            );

    scatter!((data[1,id2],data[2,id2]),
            markersize = 3.5,
            markerstrokestyle = :dot,
            aspect_ratio=:equal,
            color = :black,
            label = "Healthy"
            );

    display(p);
    pgfsave("Test.pdf",p)

Where I am using Plots with a PGFPlotsX backend to construct a plot as usual. When I try to save using “pgfsave” it errors out. Would anyone know how to fix this? A simple example is:

x = 1
y = 1
p = plot(x,y)
pgfsave("Test.pdf",p)

Would anyone know how to fix this? I am aware of An exemple in order to save figures generated by PGFPlotsX which shows that one can put it in some kind of “Axis” enviroment, but do I have to do that too?

ERROR: MethodError: no method matching save(::String, ::Plots.Plot{Plots.PGFPlotsXBackend})
Closest candidates are:
  save(::AbstractString, ::Plot; kwargs...) at C:\Users\Ahmed Salih\.julia\packages\PGFPlotsX\rS8LC\src\axiselements.jl:617
  save(::AbstractString, ::PGFPlotsX.AxisLike; kwargs...) at C:\Users\Ahmed Salih\.julia\packages\PGFPlotsX\rS8LC\src\axislike.jl:45
  save(::AbstractString, ::TikzPicture; kwargs...) at C:\Users\Ahmed Salih\.julia\packages\PGFPlotsX\rS8LC\src\tikzpicture.jl:34
  ...
Stacktrace:
 [1] top-level scope at REPL[12]:1

Kind regards

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795