# Graphs with grids that chose the user # BF=6; HF=3 f = function(x) sin(x)*sqrt(2) x1=-pi*3; x2=pi*3; y1=-1.5; y2=1.5 # I specify the distances between the grid lines horizontally and vertically # (if I do not specify the distances only the axes are plotted) TICKx=pi/4; TICKy=1/2; Plane2(x1,x2, y1,y2) graph(f, x1,x2, "brown") # I also added directions along the axes. abovex("x"); abovey("sqrt(2)*x") underX("-pi",-pi); underX("pi",pi) underY(-1,-1); underY(1,1) # This is an adequate way to easily get such charts. # We see a more sophisticated way # # # # # # # # # # f = function(x) sin(x)*sqrt(2) x1=-pi*3; x2=pi*3; y1=-1.5; y2=1.5 TICKx=pi/4; TICKy=1/2; Plane2(x1,x2, y1,y2) # I trace thicker lines to draw the x-axis and y-axis. segm(x1,0, x2,0, "blue"); segm(0,y1,0, y2, "blue") # and an additional grid. GridV( seq(-pi*3,pi*3,pi) ) graph(f, x1,x2, "brown") # I put the numeric markings on the edge of the grid by writing the formulas # using "bquote" (see) for(y in seq(y1,y2,0.5)) underY(y,y) for(i in 2:3) { x=i*pi; underX( bquote(.(i)*pi), x) } for(i in -3:-2) { x=i*pi; underX( bquote(.(i)*pi), x) } abovex("x"); abovey(bquote(sqrt(2)%.%sin(x))) underX(0,0); underX( bquote(-pi),-pi); underX( bquote(pi),pi) # I trace, subtle, also the line representing the maximum value of f line(x1,sqrt(2), x2,sqrt(2), "brown") AboveY(bquote(sqrt(2)),sqrt(2)) # With PLANE2 I behave similarly for a monometric system. # Here I choose a grate less dense, then a thicker than the standard one. BF=3; HF=3 TICKx=1/2; TICKy=1/2; PLANE2(-1,1, -1,1) circle(0,0, 1/2, "brown"); polylineR(0,0, 1, 4,0, "red"); polylineR(0,0, 1, 8,0, "blue") TICKx=0.1; TICKy=0.1; PLANE2(-1,1, -1,1) circle(0,0, 1/2, "brown"); polylineR(0,0, 1, 4,0, "red"); polylineR(0,0, 1, 8,0, "blue") # or choose no one: PLANE2(-1,1, -1,1) circle(0,0, 1/2, "brown"); polylineR(0,0, 1, 4,0, "red"); polylineR(0,0, 1, 8,0, "blue")