\documentclass[border=10pt]{standalone} \usepackage{asymptote} \begin{document} \begin{asy}[inline=true] import graph; import contour; import palette; defaultpen(fontsize(10pt)); size(14cm,8cm,IgnoreAspect); pair xyMin=(1,74); pair xyMax=(3,86); real f(real x, real y) {return -2.051^3*1000/(2*3.1415*(2.99*10^2)^2)/(x^2*Cos(y)^2);} int N=200; int Levels=16; defaultpen(1bp); bounds range=bounds(-3,-0.10); // min(f(x,y)), max(f(x,y)) real[] Cvals=uniform(range.min,range.max,Levels); guide[][] g=contour(f,xyMin,xyMax,Cvals,N,operator --); pen[] Palette=Gradient(Levels,rgb(0.3,0.06,0.5),rgb(0.9,0.9,0.85)); for(int i=0;i<g.length-1;++i){ filldraw(g[i][0]--xyMin--(xyMax.x,xyMin.y)--xyMax--cycle,Palette[i],darkblue+0.2bp); } xaxis("$x$",BottomTop,xyMin.x,xyMax.x,darkblue+0.5bp,RightTicks(Step=0.2,step=0.05),above=true); yaxis("$y$",LeftRight,xyMin.y,xyMax.y,darkblue+0.5bp,LeftTicks(Step=2,step=0.5),above=true); palette("$f(x,y)$",range,point(SE)+(0.2,0),point(NE)+(0.3,0),Right,Palette, PaletteTicks("$%+#0.1f$",N=Levels,olive+0.1bp)); \end{asy} \end{document}
Source: TeX.SE