Created
August 19, 2026 04:05
-
-
Save dohyunkim/99b3ed7f01d02c8d3ca96224c7018a31 to your computer and use it in GitHub Desktop.
shading the lines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \documentclass[border=5mm]{standalone} | |
| \usepackage{luamplib} | |
| \begin{document} | |
| \mplibtextextlabel{enable} | |
| \mpfig | |
| numeric u, v; | |
| u = 2v = 25; | |
| path xx, yy; | |
| xx = (left--right) scaled 3u; | |
| yy = origin -- up scaled 9v; | |
| path ff; | |
| ff = origin .. controls (1/3, 0) and (2/3, 1/3) .. (1,1); | |
| ff := reverse ff reflectedabout (down, up) & ff; | |
| ff := ff xscaled 3u yscaled 9v; | |
| path gg; | |
| gg = (-2,0.5) .. controls (0,-1) and (0,7) .. (1,7.8) .. controls (2,1) and (2,4) .. (3,3); | |
| gg := gg xscaled u yscaled v; | |
| draw image( | |
| drawoptions(withoutcolor withpen pencircle scaled 1); | |
| draw ff ; | |
| draw gg ; | |
| ) | |
| withshadingmethod "linear" | |
| withshadingdirection (0,3) | |
| withshadingstep ( | |
| withshadingfraction 1/3 | |
| withshadingcolors (blue, (1,1,0)) | |
| ) | |
| withshadingstep ( | |
| withshadingfraction 3/3 | |
| withshadingcolors ((1,1,0), red) | |
| ) | |
| withshadingstroke "yes" ; | |
| ahangle := 20; | |
| drawoptions(withcolor 1/2); | |
| drawdblarrow xx scaled 1.2; | |
| drawarrow yy scaled 1.1; | |
| for x = -3,-2,-1,1,2,3: | |
| draw (down--up) scaled 2 shifted (x*u,0); | |
| label.bot("$" & decimal x & "$", (x*u, -2)); | |
| endfor | |
| for y = 2, 4, 6, 8: | |
| draw (left--right) scaled 2 shifted (0, y*v); | |
| label.lft("$" & decimal y & "$", (-2, y*v)); | |
| endfor | |
| \endmpfig | |
| \end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment