Asymptote using graph.asy – fig0060

Category: Asymptote,Examples 2D,graph.asyPh. Ivaldi @ 8 h 10 min

Figure 0006
(Compiled with Asymptote version 2.14svn-r5318)
    
size(8cm,0);
import graph;

xlimits( -3pi, 3pi);
ylimits( -5, 5);
yaxis( "y" , LeftRight(), RightTicks(pTick=.8red, ptick=lightgrey, extend=true));
xaxis( "x-value", BottomTop(), Ticks(Label("$%.2f$",red), Step=2pi, step=pi/5, pTick=.8red, ptick=lightgrey, extend=true));

Étiquettes : , ,


Asymptote using graph.asy – fig0190

Category: Asymptote,Examples 2D,graph.asyPh. Ivaldi @ 20 h 10 min

Figure 0018
(Compiled with Asymptote version 2.14svn-r5318)
    
import graph;
unitsize(x=1cm, y=1.5cm);

xlimits( -3, 2);
ylimits( -2, 2);
xaxis(BottomTop, Ticks("%",extend=true, ptick=lightgrey));
yaxis(LeftRight, Ticks("%",extend=true, ptick=lightgrey));
xequals(Label("$y$",align=2NW),0,ymin=-2.5, ymax=2.5, p=linewidth(1.5pt), Arrow(2mm));
yequals(Label("$x$",align=2SE),0,xmin=-3.5, xmax=2.5, p=linewidth(1.5pt), Arrow(2mm));
labelx(Label("$1$",UnFill), 1);
labely(Label("$1$",UnFill), 1);
labelx("$O$",0,SW);
dot((0,0));


Étiquettes : , , ,


Asymptote using graph.asy – fig0200

Category: Asymptote,Examples 2D,graph.asyPh. Ivaldi @ 21 h 10 min

Figure 0019
(Compiled with Asymptote version 1.84svn-r4619)
    
import graph;

void graphicrules(picture pic=currentpicture, string prefix=defaultfilename, real unit=1cm,
                  real xunit=unit != 0 ? unit : 0,
                  real yunit=unit != 0 ? unit : 0,
                  real xmin, real xmax, real ymin, real ymax)
{
  xlimits(xmin, xmax);
  ylimits(ymin, ymax);
  unitsize(x=xunit, y=yunit);
}

void grid(picture pic=currentpicture,
          real xmin=pic.userMin().x, real xmax=pic.userMax().x,
          real ymin=pic.userMin().y, real ymax=pic.userMax().y,
          real xStep=1, real xstep=.5,
          real yStep=1, real ystep=.5,
          pen pTick=nullpen, pen ptick=grey, bool above=false)
{
  draw(pic,box((xmin,ymin),(xmax,ymax)),invisible);
  xaxis(pic, BottomTop, xmin, xmax, Ticks("%",extend=true,Step=xStep,step=xstep,pTick=pTick,ptick=ptick), above=above);
  yaxis(pic, LeftRight, ymin, ymax, Ticks("%",extend=true,Step=yStep,step=ystep,pTick=pTick,ptick=ptick), above=above);
}

void cartesianaxis(picture pic=currentpicture,
                   Label Lx=Label("$x$",align=S),
                   Label Ly=Label("$y$",align=W),
                   real xmin=pic.userMin().x, real xmax=pic.userMax().x,
                   real ymin=pic.userMin().y, real ymax=pic.userMax().y,
                   real extrawidth=1, real extraheight=extrawidth,
                   pen p=currentpen,
                   ticks xticks=Ticks("%",pTick=nullpen, ptick=grey),
                   ticks yticks=Ticks("%",pTick=nullpen, ptick=grey),
                   bool above=true,
                   arrowbar arrow=Arrow)
{
  extraheight= cm*extraheight/(2*pic.yunitsize);
  extrawidth = cm*extrawidth/(2*pic.xunitsize);
  yequals(pic, Lx, 0, xmin-extrawidth, xmax+extrawidth, p, above, arrow=arrow);
  xequals(pic, Ly, 0, ymin-extraheight, ymax+extraheight, p, above, arrow=arrow);
  yequals(pic, 0, xmin, xmax, p, xticks, above);
  xequals(pic, 0, ymin, ymax, p, yticks, above);
}

void labeloij(picture pic=currentpicture,
              Label Lo=Label("$O$",NoFill),
              Label Li=Label("$\vec{\imath}$",NoFill),
              Label Lj=Label("$\vec{\jmath}$",NoFill),
              pair diro=SW, pair diri=S, pair dirj=W,
              pen p=scale(2)*currentpen,
              filltype filltype=NoFill, arrowbar arrow=Arrow(2mm))
{
  if (Lo.filltype==NoFill) Lo.filltype=filltype;
  if (Li.filltype==NoFill) Li.filltype=filltype;
  if (Lj.filltype==NoFill) Lj.filltype=filltype;
  labelx(pic, Lo, 0, diro, p);
  draw(pic, Li, (0,0)--(1,0), diri, p, arrow);
  draw(pic, Lj, (0,0)--(0,1), dirj, p, arrow);
  dot(pic, (0,0), dotsize(p)+p);
}

//The figure starts here
graphicrules(yunit=1.5cm, xmin=-3, xmax=3, ymin=-2, ymax=2);
grid();
cartesianaxis(arrow=None);
labeloij(UnFill);

Étiquettes : , , , ,


Asymptote using graph.asy – fig0210

Category: Asymptote,Examples 2D,graph.asyPh. Ivaldi @ 22 h 10 min

Figure 0020
(Compiled with Asymptote version 1.84svn-r4619)
    
import graph;

void graphicrules(picture pic=currentpicture, real unit=1cm,
                  real xunit=unit != 0 ? unit : 0,
                  real yunit=unit != 0 ? unit : 0,
                  real xmin, real xmax, real ymin, real ymax)
{
  xlimits(xmin, xmax);
  ylimits(ymin, ymax);
  pic.unitsize(x=xunit,y=yunit);
}

picture millimeterpaper(picture pic=currentpicture, pair O=(0,0),
                        real xmin=infinity, real xmax=infinity,
                        real ymin=infinity, real ymax=infinity,
                        pen p=.5bp+orange)
{
  picture opic;
  real
    cofx=pic.xunitsize/cm,
    cofy=pic.yunitsize/cm;
  real
    xmin= (xmin == infinity) ? pic.userMin().x*cofx : xmin*cofx,
    xmax= (xmax == infinity) ? pic.userMax().x*cofx : xmax*cofx,
    ymin= (ymin == infinity) ? pic.userMin().y*cofy : ymin*cofy,
    ymax= (ymax == infinity) ? pic.userMax().y*cofy : ymax*cofy;
  path
    ph=(xmin*cm,0)--(xmax*cm,0),
    pv=(0,ymin*cm)--(0,ymax*cm);
  real [] step={5, 1, .5, .1};
  pen [] p_={ p, scale(.7)*p, scale(.4)*p, scale(.2)*p};

  for (int j=0; j<4; ++j)
    {
      for (real i=O.y; i<= ymax; i+=step[j])
        draw(opic, shift(0,i*cm)*ph, p_[j]);
      for (real i=O.y; i>=ymin ; i-=step[j])
        draw(opic, shift(0,i*cm)*ph, p_[j]);
      for (real i=O.x; i<=xmax; i+=step[j])
        draw(opic, shift(i*cm,0)*pv, p_[j]);
      for (real i=O.x; i>=xmin; i-=step[j])
        draw(opic, shift(i*cm,0)*pv, p_[j]);
    }

  return opic;
}

graphicrules(xunit=2cm, yunit=1.5cm, xmin=-3, xmax=2, ymin=-2, ymax=2);
add(millimeterpaper(p=3bp+orange),(0,0));
xaxis(xmin=-3, xmax=2, Ticks("%"));
yaxis(ymin=-2, ymax=2, Ticks("%"));
xequals(Label("$y$",align=2NW),0,ymin=-2.25, ymax=2.25, p=linewidth(1.5pt), Arrow(2mm));
yequals(Label("$x$",align=2SE),0,xmin=-3.25, xmax=2.25, p=linewidth(1.5pt), Arrow(2mm));
labelx(Label("$1$",UnFill), 1);
labely(Label("$1$",UnFill), 1);
labelx("$O$",0,SW);
dot((0,0));

Étiquettes : ,


Asymptote using graph.asy – fig0220

Category: Asymptote,Examples 2D,graph.asyPh. Ivaldi @ 23 h 10 min

Figure 0021
(Compiled with Asymptote version 2.14svn-r5318)
    
/*One can see this graphe drawed with my package HERE*/
import graph;
import patterns;
usepackage("mathrsfs");

unitsize(2cm,1.5cm);
real xmin=-1,xmax=4;
real ymin=-1,ymax=5;

// Definition of fonctions f and g :
real f(real x) {return 4x-x^2+4/(x^2+1)^2;}
real g(real x) {return x-1+4/(x^2+1)^2;}

// Trace the curves :
path Cf=graph(f,xmin,xmax,n=400);
path Cg=graph(g,xmin,xmax,n=400);
draw(Cf,linewidth(1bp));
draw(Cg,linewidth(1bp));
xlimits(xmin,xmax,Crop);
ylimits(ymin,ymax,Crop);

// The grid :
xaxis(BottomTop, xmin, xmax, Ticks("%", Step=1, step=0.5, extend=true, ptick=lightgrey));
yaxis(LeftRight, ymin, ymax, Ticks("%", Step=1, step=0.5, extend=true, ptick=lightgrey));
// The axis.
xequals(Label("$y$",align=W),0,ymin=ymin-0.25, ymax=ymax+0.25,
        Ticks(NoZero,pTick=nullpen, ptick=grey),
        p=linewidth(1pt), Arrow(2mm));
yequals(Label("$x$",align=S),0,xmin=xmin-0.25, xmax=xmax+0.25,
        Ticks(NoZero,pTick=nullpen, ptick=grey),
        p=linewidth(1pt), Arrow(2mm));

labelx(Label("$O$",NoFill), 0, SW);
draw(Label("$\vec{\imath}$",align=S,UnFill),
     (0,0)--(1,0),scale(2)*currentpen,Arrow);
draw(Label("$\vec{\jmath}$",align=W,UnFill),
     (0,0)--(0,1),scale(2)*currentpen,Arrow);
dot((0,0));

label("$\mathscr{C}_f$",(2.25,f(2.25)),2N);
label("$\mathscr{C}_f$",(2.25,g(2.25)),2S);

// Les hachures.
path vline=(1,-1)--(1,5);
add("hachure",hatch(3mm));
fill(buildcycle(vline,graph(f,1,4),graph(g,1,4)),pattern("hachure")); 

Étiquettes : , , , , ,


Unofficial package graph_pi.asy – fig0010

Category: Asymptote,graph_pi.asy,Unofficial packagesPh. Ivaldi @ 5 h 50 min

Figure 0001
(Compiled with Asymptote version 2.14svn-r5318)
    
import graph_pi;

graphicrules(yunit=1.5cm, xmin=-3, xmax=3, ymin=-2, ymax=2);
grid();
cartesianaxis(arrow=None);
labeloij(UnFill);

Étiquettes : , ,


Unofficial package graph_pi.asy – fig0020

Category: Asymptote,graph_pi.asy,Unofficial packagesPh. Ivaldi @ 6 h 50 min

Figure 0002
(Compiled with Asymptote version 2.14svn-r5318)
    
import graph_pi;

graphicrules(yunit=1.5cm, xmin=-3, xmax=3, ymin=-2, ymax=2);
grid(pic=currentpicture,
     xmin=-3, xmax=3,
     ymin=-2, ymax=2,
     xStep=1, xstep=.1,
     yStep=1, ystep=.1,
     pTick=.8red, ptick=.8green,
     above=false);
cartesianaxis(pic=currentpicture,
              Lx=Label(scale(2)*"$x$",align=NW),
              Ly=Label("$y$",align=SE),
              xmin=-3, xmax=3,
              ymin=-2, ymax=2,
              extrawidth=5, extraheight=5,
              p=currentpen,
              xticks=Ticks("%",pTick=1mm+yellow, ptick=grey),
              yticks=NoTicks,
              viewxaxis=true,
              viewyaxis=false,
              above=true,
              arrow=Arrow);
labeloIJ(pic=currentpicture,
         Lo=Label("$O$",NoFill),
         LI=Label("$I$",white,Fill(black)),
         LJ=Label(" "),
         diro=NE, dirI=N, dirJ=E,
         p=blue,
         filltype=NoFill,
         marker=dot(2mm+red));

Étiquettes : , ,


Unofficial package graph_pi.asy – fig0030

Category: Asymptote,graph_pi.asy,Unofficial packagesPh. Ivaldi @ 7 h 50 min

Figure 0003
(Compiled with Asymptote version 2.14svn-r5318)
    
import graph_pi;
size(200,0);
graphicrules(xmin=-1, xmax=4, ymin=-1, ymax=3);

grid(xstep=0,ystep=0);

cartesianaxis(xticks=Ticks(Label(Fill(white)), NoZero, ptick=invisible),
              yticks=Ticks(Label(Fill(white)), NoZero, ptick=invisible));

labelx("$O$",0,SW);

shipout(bbox(Fill(white)));

Étiquettes : , ,


Unofficial package graph_pi.asy – fig0040

Category: Asymptote,graph_pi.asy,Unofficial packagesPh. Ivaldi @ 8 h 50 min

Figure 0004
(Compiled with Asymptote version 2.14svn-r5318)
    
import graph_pi;

graphicrules(xunit=2cm, yunit=1.5cm, xmin=-3, xmax=2, ymin=-2, ymax=2);
add(millimeterpaper(p=3bp+orange),(0,0));
cartesianaxis();
labelx(Label("$1$",UnFill), 1);
labely(Label("$1$",UnFill), 1);
labelx("$O$",0,SW);
dot((0,0));

Étiquettes : ,


Unofficial package graph_pi.asy – fig0050

Category: Asymptote,graph_pi.asy,Unofficial packagesPh. Ivaldi @ 9 h 50 min

Figure 0005
(Compiled with Asymptote version 2.14svn-r5318)
    
import graph_pi;

graphicrules(xunit=2cm, yunit=1.5cm, xmin=-3, xmax=2, ymin=-2, ymax=2);
add(millimeterpaper(pic=currentpicture, O=(0,0),
                    xmin=-2.5, xmax=1.5,
                    ymin=-1.5, ymax=1.5,
                    p=3bp+orange),
    (0,0));
cartesianaxis();
labelx(Label("$1$",UnFill), 1);
labely(Label("$1$",UnFill), 1);
labelx("$O$",0,SW);
dot((0,0));

Étiquettes : ,


Unofficial package graph_pi.asy – fig0070

Category: Asymptote,graph_pi.asy,Unofficial packagesPh. Ivaldi @ 11 h 50 min

Figure 0007
(Compiled with Asymptote version 2.14svn-r5318)
    
import graph_pi;

graphicrules(xunit=1cm, yunit=2cm,
             xmin=-2pi, xmax=2pi, ymin=-1, ymax=1);

yaxis("y",LeftRight ,
      Ticks(labelfrac,Step=.5,step=.25, ptick=grey, extend=true));

xaxis("$\theta$",BottomTop,
      Ticks(labelfrac(factor=pi,symbol="\pi",symbolin=false),
            Step=pi/2, step=pi/4, ptick=grey, extend=true));

draw(graph(new real(real x){return sin(x);},-2pi,2pi));
draw(graph(new real(real x){return cos(x);},-2pi,2pi), .8red);

Étiquettes : , ,


Unofficial package graph_pi.asy – fig0080

Category: Asymptote,graph_pi.asy,Unofficial packagesPh. Ivaldi @ 12 h 50 min

Figure 0008
(Compiled with Asymptote version 2.14svn-r5318)
    
import graph_pi;

graphicrules(xunit=1cm, yunit=3cm,
             xmin=-2pi, xmax=2pi, ymin=-1, ymax=1);

grid(xStep=pi/2, xstep=pi/4, yStep=.5, ystep=.25);

cartesianaxis(xticks=Ticks(Label(Fill(white)),
                           labelfrac(factor=pi,symbol="\pi",symbolin=true,
                                     zero=false),Step=pi/2, step=pi/4, ptick=grey),
              yticks=Ticks(Label(Fill(white)),
                           labelfrac(zero=false),Step=.5,step=.25, ptick=grey), Arrow);

dot("$O$",(0,0),2SW);

shipout(bbox(Fill(white)));

Étiquettes : , ,


Official Asymptote example – grid

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 20 h 57 min

Figure 0085
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import math;
size(100,0);

add(shift(-5,-5)*grid(10,10));

dot((0,0),red);


Étiquettes :


Official Asymptote example – loggrid

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 11 h 57 min

Figure 0131
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import graph;
size(200,200,IgnoreAspect);

real f(real t) {return 1/t;}

scale(Log,Log);
draw(graph(f,0.1,10),red);
pen thin=linewidth(0.5*linewidth());
xaxis("$x$",BottomTop,LeftTicks(begin=false,end=false,extend=true,
                                ptick=thin));
yaxis("$y$",LeftRight,RightTicks(begin=false,end=false,extend=true,
                                 ptick=thin));


Étiquettes : , , ,