vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
555 stars 92 forks source link

the svg output is different from the pdf or png output #292

Closed justonlyasy closed 2 years ago

justonlyasy commented 2 years ago

Consider this code which is compiled on http://asymptote.ualberta.ca/

settings.render=10;
import graph;
import palette;
import contour;

size(350,350);

pair a=(-6,-6);
pair b=(6,6);

real f(real x, real y) {return (x/5)^2+(y/3)^2;}
int N=200;
int Divs=16;

defaultpen(.9bp);
pen Tickpen=black;
pen[] Palette=quantize(BWRainbow(),Divs);

bounds range=image(f,a,b,3N,Palette,Divs);
real[] Cvals=uniform(range.min,range.max,Divs);
Cvals.pop();
draw(contour(f,a,b,Cvals,N),Tickpen+extendcap+beveljoin);

crop();
limits(a-(0.3,0.3),b+(0.3,0.3));

xaxis("$x$",BottomTop,LeftTicks(Size=4,size=2));
yaxis("$y$",LeftRight,RightTicks(Size=4,size=2));

the svg ouput is image while the png output is image and the pdf output is image

johncbowman commented 2 years ago

Your crop command is still in the wrong place. I will post one more update to your example in issue #263 that resolves this issue too.