我怎样才能用 LaTeX 制作有关图形的图表?

我怎样才能用 LaTeX 制作有关图形的图表?

如何在 LaTeX 中制作以下图表:

在此处输入图片描述

答案1

我已经在 TikZ 中制作了完整的图表。您可以在此处阅读 TikZ 手册:http://texdoc.net/pkg/tikz

图表

\documentclass[a4paper,landscape]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage[scale=1]{geometry}
\begin{document}
\hfill
\vfill
\begin{figure}[htp]
\centering
\tikz[scale=0.9]{
\coordinate (C2) at (0,4);
\coordinate (C3) at (0,3);
\coordinate (C4) at (0,2);
\coordinate (C5) at (0,-2);
\coordinate (B1) at (-3,1.5);
\coordinate (B2) at (-3,0.5);
\coordinate (kh11) at (-9,5);
\coordinate (kh21) at (-8,6);
\coordinate (kh12) at (-9,-3);
\coordinate (kh22) at (-8,-4);
\coordinate (kh13) at (-12,2);
\coordinate (kh23) at (-12,0);
\coordinate (v1) at (-8,2);
\coordinate (vi) at (-8,1);
\coordinate (vn) at (-8,0);
\fill (kh13) +(0,-0.75) circle (1.5pt);
\fill (kh23) +(0,0.75) circle (1.5pt);
\fill (-12,1) circle (1.5pt);
\node at (-12.5,1) {$K_h$};
\node at (-13.5,1) {\Large $A_i$};
\draw [black!70!white,very thick] (-12,1) circle (1 and 2);
\node at (-9.5,3) {\Huge \textbf{G}};
\draw [black!70!white,very thick] (vi) circle (1.5 and 2);
\draw [gray] (B1) -- (C2);
\draw [gray] (B2) -- (C2);
\draw [gray] (B1) -- (C3);
\draw [gray] (B2) -- (C3);
\draw [gray] (B1) -- (C4);
\draw [gray] (B2) -- (C4);
\draw [gray] (B1) -- (C5);
\draw [gray] (B2) -- (C5);
\draw [gray] (B1) -- (v1);
\draw [gray] (B1) -- (vi);
\draw [gray] (B1) -- (vn);
\draw [gray] (B2) -- (v1);
\draw [gray] (B2) -- (vi);
\draw [gray] (B2) -- (vn);
\draw [gray] (v1) -- (kh11);
\draw [gray] (v1) -- (kh21);
\draw [gray] (vn) -- (kh12);
\draw [gray] (vn) -- (kh22);
\path (kh11) +(-1.5,1.5) node {\Large $A_1$};
\path (kh22) +(-2.25,-0.75) node {\Large $A_n$};
\fill (kh13) circle (3pt);
\fill (kh23) circle (3pt);
\fill (C2) circle (3pt);
\fill (C3) circle (3pt);
\fill (C4) circle (3pt);
\fill (0,0.2) circle (1.5pt);
\fill (0,0) circle (1.5pt);
\fill (0,-0.2) circle (1.5pt);
\fill (C5) circle (3pt);
\draw [gray,dashed] (0,4.5) -- (0.5,4.5) -- (0.5,-2.5) -- (0,-2.5);
\draw [gray,dashed] (0.5,1) -- (1.5,1);
\node at (2,1) {\Huge \textbf{C}};
\node at (-3,0) {$K_{[B]}$};
\draw [black!70!white,very thick] (-3,1) circle (1.5);
\node at (-3,3) {\Huge \textbf{B}};
\draw [gray] (kh11) -- (B1) ;
\draw [gray] (kh11) -- (B2) ;
\draw [gray] (kh21) -- (B1) ;
\draw [gray] (kh21) -- (B2) ;
\draw [gray] (kh12) -- (B1) ;
\draw [gray] (kh12) -- (B2) ;
\draw [gray] (kh22) -- (B1) ;
\draw [gray] (kh13) -- (B1) ;
\draw [gray] (kh23) -- (B1) ;
\draw [gray] (kh13) -- (B2) ;
\draw [gray] (kh23) -- (B2) ;
\fill (kh11) circle (3pt) ;
\fill (kh21) circle (3pt) ;
\fill (-8.6,6) circle (1.5pt) ;
\fill (-8.85,5.8) circle (1.5pt) ;
\fill (-9,5.5) circle (1.5pt) ;
\node at (-9.25,6.2) {$K_h$};
\draw [black!70!white,very thick] (-8.5,5.5) circle (1.5);
\fill (kh12) circle (3pt) ;
\fill (kh22) circle (3pt) ;
\fill (-8.6,-4) circle (1.5pt) ;
\fill (-8.85,-3.8) circle (1.5pt) ;
\fill (-9,-3.5) circle (1.5pt) ;
\node at (-9.25,-4.2) {$K_h$};
\draw [black!70!white,very thick] (-8.5,-3.5) circle (1.5);
\fill (B1) circle (3pt);
\fill (B2) circle (3pt);
\fill (-3,1.20) circle (1.25pt);
\fill (-3,1) circle (1.25pt);
\fill (-3,0.80) circle (1.25pt);
\draw [gray] (kh13) -- (vi) ;
\draw [gray] (kh23) -- (vi) ;
\fill (v1) circle (3pt); \node [left] at (v1) {$v_1$};
\fill (vi) circle (3pt); \node [left] at (vi) {$v_i$};
\fill (vn) circle (3pt); \node [left] at (vn) {$v_n$};
\draw [dash pattern=on 2pt off 1cm] (-12,3.2) to [in=180,out=90] (-10,6);
\draw [dash pattern=on 2pt off 1cm] (-12,-1.2) to [out=-90,in=180] (-10,-4);
}
\end{figure}
\vfill
\hfill
\end{document}

答案2

在此处输入图片描述

MWE使用Asymptote面向对象的方法来构建图表。

% diag.tex :
%
\documentclass{article}
\usepackage[inline]{asymptote}
\begin{asydef}
void vdots(pair a,pair b,pen p=currentpen+1.5bp){
  for(int i=1;i<4;++i) dot(a*(1-i/4)+b*i/4,p);
}

void arcdots(guide g,int n=3, pen p=currentpen+1.5bp){
  real L=arclength(g);
  pair a=point(g,0); pair b=point(g,size(g));
  for(int i=1;i<n+1;++i) dot(arcpoint(g,L*i/(n+1)),p);
}

struct scircle{
  pair center;
  real R;
  real phi;  // rotation angle
  real dotShift;
  string L;
  pair Lpos;
  pen borderPen;

  transform tr;
  guide border;
  pair ptA, ptB;

  void draw(){ draw(border,borderPen); }

  void drawDots(){
    dot(ptA,UnFill); dot(ptB,UnFill);
    vdots(ptA,ptB);
    label(L,tr*Lpos);
  }

  pair borderPoint(pair Dir){
    return intersectionpoint(border,center--(scale(2R)*unit(Dir)+center));
  }

  void operator init(
    pair center=(0,0),
    real R=1,
    real phi=0,  
    real dotShift=0.382,
    string L,
    pair Lpos=(-dotShift*sqrt(3),0),
    pen borderPen=currentpen
  ){
    this.center    = center    ;
    this.R         = R         ;
    this.phi       = phi       ;
    this.dotShift  = dotShift  ;
    this.L         = L         ;
    this.Lpos      = Lpos      ;
    this.borderPen = borderPen ;

    tr=shift(center)*scale(R)*rotate(phi);
    this.border=tr*unitcircle;
    this.ptA=tr*(0,dotShift);
    this.ptB=tr*(0,-dotShift);
  }  
}

void connect(scircle a, pair[] inptPoint, pen linePen=gray+0.3bp){
  for(int i=0;i<inptPoint.length;++i){
    draw(a.ptA--inptPoint[i]--a.ptB,linePen);
  }
}
\end{asydef}
\usepackage{lmodern}
\begin{document}
\begin{figure}
\begin{asy}
size(280);

import fontsize;
defaultpen(fontsize(9pt));

scircle A1=scircle((260, 200),60,-45,"$K_h$");
scircle Ai=scircle((120,   0),60,0,"$K_h$",(-0.6,0));
scircle An=scircle((260,-200),60,45,"$K_h$");
scircle B =scircle((500,   0),60,0,"$K_{[B]}$",(-0.6,0));


real dh=50;
int ndots=4;
pair[] inputPoint=new pair[ndots+1];

for(int i=0;i<ndots;++i) inputPoint[i]=(630,(ndots-i)*dh);

inputPoint[ndots]=(inputPoint[0].x,-inputPoint[0].y);

vdots((inputPoint[0].x,0),(inputPoint[0].x,-inputPoint[ndots-1].y));

pair[] v={(A1.ptA.x,dh), (A1.ptA.x,0), (A1.ptA.x,-dh)};

guide gG=shift(v[1])*scale(Ai.R,2dh)*unitcircle; draw(gG);

label("$v_1$",v[0],W); label("$v_i$",v[1],W); label("$v_n$",v[2],W);

connect(A1,new pair[]{v[0],B.ptA,B.ptB});
connect(Ai,new pair[]{v[1],B.ptA,B.ptB});
connect(An,new pair[]{v[2],B.ptA,B.ptB});

connect(B,inputPoint); connect(B,v);

A1.draw(); Ai.draw(); An.draw(); B. draw();

dot(inputPoint,UnFill); dot(v,UnFill);

A1.drawDots(); Ai.drawDots(); An.drawDots(); B. drawDots();

vdots(v[0],v[1]); vdots(v[2],v[1]);

guide garc=A1.borderPoint(W)
..(0.5(A1.borderPoint(W)+Ai.borderPoint(N))+(-dh,dh)/3)
..Ai.borderPoint(N);

arcdots(garc,7); arcdots(reflect(W,E)*garc,7);

pen dashed=gray+0.5bp+linetype(new real[]{7,6});

guide gdashedA=(inputPoint[0]+(0,dh/2))
--(inputPoint[0]+(dh/2,dh/2))
--(inputPoint[ndots]+(dh/2,-dh/2))
--(inputPoint[ndots]+(0,-dh/2));

guide gdashedB=(inputPoint[0].x+dh/2,0)--(inputPoint[0].x+dh,0);

draw(gdashedA^^gdashedB,dashed);

label("$\mathbf{A_1}$",A1.borderPoint(NW),NW);
label("$\mathbf{A_i}$",Ai.borderPoint(W),W);
label("$\mathbf{A_n}$",An.borderPoint(SW),SW);
label("$\mathbf{B}$",B.borderPoint(N),N);
label("$\mathbf{C}$",point(gdashedB,1),E);
label("$\mathbf{G}$",v[0],8NW);
\end{asy}
\end{figure}
\end{document}
%
% Process :
%
% pdflatex diag.tex    
% asy diag-*.asy    
% pdflatex diag.tex

相关内容