Example of log- and log-log- axis labels.
MGL code:
subplot 2 2 0 '<_':title 'Semi-log axis':ranges 0.01 100 -1 1:axis 'lg(x)' '' '' axis:grid 'xy' 'g':fplot 'sin(1/x)':xlabel 'x' 0:ylabel 'y = sin 1/x' 0 subplot 2 2 1 '<_':title 'Log-log axis':ranges 0.01 100 0.1 100:axis 'lg(x)' 'lg(y)' '' axis:grid '!' 'h=':grid:fplot 'sqrt(1+x^2)' xlabel 'x' 0:ylabel 'y = \sqrt{1+x^2}' 0 subplot 2 2 2 '<_':title 'Minus-log axis':ranges -100 -0.01 -100 -0.1:axis '-lg(-x)' '-lg(-y)' '' axis:fplot '-sqrt(1+x^2)':xlabel 'x' 0:ylabel 'y = -\sqrt{1+x^2}' 0 subplot 2 2 3 '<_':title 'Log-ticks':ranges 0.01 100 0 100:axis 'sqrt(x)' '' '' axis:fplot 'x':xlabel 'x' 1:ylabel 'y = x' 0
C++ code:
void smgl_loglog(mglGraph *gr) // log-log axis { gr->SubPlot(2,2,0,"<_"); gr->Title("Semi-log axis"); gr->SetRanges(0.01,100,-1,1); gr->SetFunc("lg(x)",""); gr->Axis(); gr->Grid("xy","g"); gr->FPlot("sin(1/x)"); gr->Label('x',"x",0); gr->Label('y', "y = sin 1/x",0); gr->SubPlot(2,2,1,"<_"); gr->Title("Log-log axis"); gr->SetRanges(0.01,100,0.1,100); gr->SetFunc("lg(x)","lg(y)"); gr->Axis(); gr->Grid("!","h="); gr->Grid(); gr->FPlot("sqrt(1+x^2)"); gr->Label('x',"x",0); gr->Label('y', "y = \\sqrt{1+x^2}",0); gr->SubPlot(2,2,2,"<_"); gr->Title("Minus-log axis"); gr->SetRanges(-100,-0.01,-100,-0.1); gr->SetFunc("-lg(-x)","-lg(-y)"); gr->Axis(); gr->FPlot("-sqrt(1+x^2)"); gr->Label('x',"x",0); gr->Label('y', "y = -\\sqrt{1+x^2}",0); gr->SubPlot(2,2,3,"<_"); gr->Title("Log-ticks"); gr->SetRanges(0.1,100,0,100); gr->SetFunc("sqrt(x)",""); gr->Axis(); gr->FPlot("x"); gr->Label('x',"x",1); gr->Label('y', "y = x",0); }