lmiq
October 24, 2018, 6:48pm
1
I am not sure if I am doing something wrong, apparently that should work. The “size” function is not affecting the plot output size, in:
using PyPlot
x = [1,2]
y = x
plot(x,y)
size(10,200)
savefig("./test.png")
I tried also
savefig("./test.png",figsize=(10,200))
or
savefig("./test.png",width=10,height=200)
Without any result either.
Thank you for your help.
1 Like
nilshg
October 25, 2018, 2:44pm
2
I believe size(10, 200)
simply calls size(x::Number, d)
, and returns 1
(as 10
is a scalar).
I haven’t really used PyPlot in Julia for a while other than through Plots.jl, but in Python I would do something like:
fig, ax = subplots(figsize=(10,10))
ax[:plot](rand(100))
Which does change the figure size for me. (Note that in 1.0 I think PyPlot has gained the ability to understand dot notation so you can possibly write ax.plot
)
1 Like
lmiq
October 25, 2018, 5:25pm
3
Thank you. I was not aware that the reasonable choice was to use Plots. This works:
using Plots
x = [1,2]
y = x
plot(x,y)
plot!(size=(400,400))
savefig("test.pdf")
9 Likes