I would like to save a picture using the following code, however too large space appears.
using Plots
I1=2/3;I2=1;I3=2;
plot(legend=false,grid=false,axis=false,aspect_ratio=:equal,size=(700,700),camera=(-50,32),widen=true) # clear the plot
for H in vcat(.01:0.05:0.46, .5, .54:0.05:1.5)
y1=-1:.0001:0
y2=sqrt.(Complex.(((2 .*H-1/I3).-(1/I1-1/I3) *y1 .^2)/(1/I2-1/I3)));
y3=sqrt.(Complex.(((2 .*H-1/I2).-(1/I1-1/I2) *y1 .^2)/(1/I3-1/I2)));
m=1;
y1_new = Float64[]; #make these Float64 because otherwise y2 and y3 are complex, so we will be pushing complex numbers (with 0 imaginary part) rather than real numbers.
y2_new = Float64[];
y3_new = Float64[];
for k = 1:length(y1)
if( imag(y2[k])==0 && imag(y3[k])==0 )
push!(y1_new, y1[k]);
push!(y2_new, y2[k]);
push!(y3_new, y3[k]);
m=m+1;
end
end
if(m>1)
# use plot3d! rather than plot3d to update rather than replace the plot
plot3d!(y1_new,y2_new,y3_new,lc=:black,lw=0.5)
plot3d!(y1_new,-y2_new,y3_new,lc=:black,lw=0.5)
plot3d!(y1_new,y2_new,-y3_new,lc=:black,lw=0.5)
plot3d!(y1_new,-y2_new,-y3_new,lc=:black,lw=0.5)
plot3d!(-y1_new,y2_new,y3_new,lc=:black,lw=0.5)
plot3d!(-y1_new,-y2_new,y3_new,lc=:black,lw=0.5)
plot3d!(-y1_new,y2_new,-y3_new,lc=:black,lw=0.5)
plot3d!(-y1_new,-y2_new,-y3_new,lc=:black,lw=0.5)
end
end
plot3d!([0,0,0],[0,0,0],[0,0,1.5],arrow=true,color=:black,linewidth=0.8)
plot3d!([0,0,0],[0,-1.5,0],[0,0,0],arrow=true,color=:black,linewidth=0.8)
plot3d!([0,-1.5,0],[0,0,0],[0,0,0],arrow=true,color=:black,linewidth=0.8)
#savefig("sphere.pdf")
I need to be appeared with 0 space between the paper and the figure?