Examples

library(pikchr)

Disclaimer Some of the examples below are derived from the Pikchr project.

Example 1

# fontFamily: Abel

/*
 Example 1. André Leite (leite@castlab.org)
 */
/*  1 */ dimen_ = 1
/*  2 */ Origem: (0,0) 
/*  3 */ B1:box "Microfone";
/*  4 */ L1:line from B1.e right dimen_/2;
/*  5 */ L2:line -> up dimen_/3.2 then right dimen_/2;
/*  6 */ L3:line -> from L1.end down dimen_/3.2 then right dimen_/2; 
/*  7 */ B2:box "Filtro PF" "em f₀" with .w at L2.end;
/*  8 */ B3:box "Filtro PF" "em f₁" with .w at L3.end;
/*  9 */ L4:line -> from B2.e right dimen_/2 then down dimen_/3.2 \
/* 10 */     then right dimen_/2 
/* 11 */ L4:line -> from B3.e right dimen_/2 then up dimen_/3.2 \
/* 12 */     then right dimen_/2 
/* 13 */ B4: box "Rede" "Neural" with .w at (L4.end.x,L1.end.y)         
Microfone Filtro PF em f₀ Filtro PF em f₁ Rede Neural

Example 2

/*
 Example 2. André Leite (leite@castlab.org)
 */
  
dimen_= .75
Origem:(0,0) 
B1:box "Agente" "Externo";
L1:line -> from B1.s down dimen_/4 \
  then left 1.5*dimen_ \
  then down dimen_/4; 
B2:box wid 1 "Sensores" "Digitais";
L2:line -> from B1.s down dimen_/4 \
  then right 1.5*dimen_ \
  then down dimen_/4;
B3:box wid 1 "Sensores" "Analógicos";
L3:line -> from B2.s down dimen_/2;
B4:box wid 1 "Transmissor" "FSK";
L4:line -> from B3.s down dimen_/2; 
B5:box wid 1 "Transmissor" "FM"; 
L5:line -> from B4.s down dimen_/2; 
B6:box wid 1 "Receptor" "FSK";
L6:line -> from B5.s down dimen_/2; 
B7:box wid 1 "Receptor" "FM";
L7:line -> from B6.s down .5*dimen_ then right 4.5*dimen_ \  
  then up 3*dimen_ \
  then right .5*dimen_ 
L8:line -> from B7.s down .25*dimen_ then right 1.25*dimen_ \  
  then up 3*dimen_ \
  then right .75*dimen_
B8:box wid 1 "Rede" big "Neural" big \
  with .w at 1/2<L7.end, L8.end> fill lightblue
L9:line -> from B8.e right dimen_;
B9:box wid 1 "Sistema de" "Controle" "de Acesso";
L10:line -> from B8.e+(0,boxht/6) right dimen_/2 \ 
  then up dimen_ then right dimen_/2; 
B10:box wid 1 "Sistema de" "Alarme";
L11:line -> from B8.e-(0,boxht/6) right dimen_/2 \ 
  then down dimen_ then right dimen_/2; 
B11:box wid 1 "Sistema de" "Anúncio";         
Agente Externo Sensores Digitais Sensores Analógicos Transmissor FSK Transmissor FM Receptor FSK Receptor FM Rede Neural Sistema de Controle de Acesso Sistema de Alarme Sistema de Anúncio

Example 3

/*
 Example 3. André Leite (leite@castlab.org)
 */
$len = 175px;
margin = 20px;
/* First Stage */
          B1E: box rad 5px wid 2*$len fill white;
    LineCusto: line <- from B1E.n - ((2/3)*$len,0) up .25*$len;
     BoxCusto: box rad 5px "Custo" wid .5*$len ht .25*$len fill 0xFFD320;
LineDistancia: line <- thick from BoxCusto.w + (0,.25*$len/6) \
                    left .25*$len/2 \  
                    then up .25*$len/6 \
                    then left .15*$len/2;
               box rad 10px "Distância" fit wid .35*$len fill 0xFFD320;
    LineTempo: line <- thick  from BoxCusto.w - (0,.25*$len/6) \
                    left .25*$len/2 \  
                    then down .25*$len/6  then left .15*$len/2 \
                    color gray;
               box rad 10px "Tempo" fit wid .35*$len fill 0xFFD320;
               text "Primeiro Estágio" bold at B1E.c  color black;
   LineNumMat: line <- from B1E.n - ((0)*$len,0) up .25*$len;
           NM: box rad 10px fill 0x004586 ht .25*$len wid .6*$len;
 LineDemRisco: line <- from B1E.n + ((2/3)*$len,0) up .25*$len;
           NR: box rad 10px  wid .6*$len fill 0x7E0021 ht .25*$len;
               text "Número de Novas" "Maternidades" at NM.c color white;
               text "Nascimentos" "de risco" at NR.c color white;
/*Second Stage */
          B2E: box rad 5px with .n at B1E.s - (0, (.6)*$len) \
               wid 2*$len fill white;
    LineOfeta: line <- from B2E.n up .2*$len;
           OF: box rad 10px "Nascimentos" "no município" fit \
               wid .5*$len fill 0xFF420E;
  LineDemanda: line <- from B2E.n - ((2/3)*$len,0) up .2*$len;
           DM: box rad 10px "Nascimentos" "de residentes" \
               fit wid .5*$len fill 0x83CAFF;
LineResultado: line -> "Polos" aligned above italic from B2E.e \
               right .35*$len;
           RS: file "Resultado" bold ht .25*$len wid .5*$len fill 0x579D1C;
   LineSegEst: line -> "Macropolos" above italic aligned from B1E.s + \
                      ((2/3)*$len,0) down .6*$len; 
               text "Segundo Estágio" bold at B2E.c color black;
           BX: box thin dashed with .c at 1/2<OF.c,DM.c> \
               wid 1.35*$len ht OF.height + .2;
               text "Município" above at BX.n;
/* Fim */