You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got an unexpected result in a contour plot: the lines had way too many labels. A simplified demo code is pasted below, and the corresponding pdf output is attached. The left and right sides show contour lines for the same function with two different scalings of its input coordinates (using different units). The blue plot on the left looks as expected. The red one on the right should look the same (it is the same function), but it does not. The reason seems to be that contour() sometimes breaks what should be a single returned guide into many pieces, and this behavior is scale-dependent.
`
//----------------------------------------------------------------
// Draw a contour plot with labels. In Asymptote 2.92 the number of
// labels depends on the scaling of the function (e.g. whether X and Y
// are expressed in meters or mm). The reason is that contour()
// sometimes breaks what should be a single returned guide into
// pieces, and this behavior is scale-dependent.
import contour;
real f_m(real x, real y) {
return x^2 - y^2;
}
real f_mm(real x, real y) {
return (x/1000)^2 - (y/1000)^2;
}
Hello,
I got an unexpected result in a contour plot: the lines had way too many labels. A simplified demo code is pasted below, and the corresponding pdf output is attached. The left and right sides show contour lines for the same function with two different scalings of its input coordinates (using different units). The blue plot on the left looks as expected. The red one on the right should look the same (it is the same function), but it does not. The reason seems to be that contour() sometimes breaks what should be a single returned guide into many pieces, and this behavior is scale-dependent.
Andrei
contour-scale-labels.pdf
`
//----------------------------------------------------------------
// Draw a contour plot with labels. In Asymptote 2.92 the number of
// labels depends on the scaling of the function (e.g. whether X and Y
// are expressed in meters or mm). The reason is that contour()
// sometimes breaks what should be a single returned guide into
// pieces, and this behavior is scale-dependent.
import contour;
real f_m(real x, real y) {
return x^2 - y^2;
}
real f_mm(real x, real y) {
return (x/1000)^2 - (y/1000)^2;
}
pair Am = (-20, -20);
pair Bm = (+20, +20);
pair Amm = 1000 * Am;
pair Bmm = 1000 * Bm;
real[] c = {20.};
Label[] lab = { Label("20", Relative(0.2), (0,0), UnFill(1bp)) };
picture pic1;
size(pic1,200);
draw(pic1, lab, contour(pic1, f_m, Am, Bm, c), blue);
picture pic2;
size(pic2, 200);
draw(pic2, lab, contour(pic2, f_mm, Amm, Bmm, c), red);
add(pic1.fit(), (0,0), W);
add(pic2.fit(), (0,0), 100E);
//----------------------------------------------------------------
`
The text was updated successfully, but these errors were encountered: