TransWikia.com

draw a picture by latex

TeX - LaTeX Asked by Alfons on January 31, 2021

I would like to draw the following graph in the image with LaTeX.

enter image description here

3 Answers

Just for fun using mathcha with iwona font. PS User without MWE.

%% Compile and read me!
documentclass[a4paper,12pt]{article}
usepackage{tikz}
usepackage[math]{iwona}
usepackage[T1]{fontenc}
usepackage{graphicx}

begin{document}
First word
begin{figure}[h]
  centering
  tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        
begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
draw    (100,129.2) -- (368.5,129.2) (145,125.2) -- (145,133.2)(190,125.2) -- (190,133.2)(235,125.2) -- (235,133.2)(280,125.2) -- (280,133.2)(325,125.2) -- (325,133.2) ;
%Shape: Square [id:dp6094930652284849] 
draw   (100,84.7) -- (144.5,84.7) -- (144.5,129.2) -- (100,129.2) -- cycle ;
%Shape: Rectangle [id:dp375122879762261] 
draw   (144.36,85) -- (280.36,85) -- (280.36,129.2) -- (144.36,129.2) -- cycle ;
%Shape: Rectangle [id:dp31151300443341423] 
draw   (280.36,85) -- (368.36,85) -- (368.36,129.2) -- (280.36,129.2) -- cycle ;
%Shape: Arc [id:dp47364655068525563] 
draw  [draw opacity=0] (280.72,84.13) .. controls (269.63,59.54) and (234.2,41.14) .. (191.9,40.41) .. controls (147.56,39.65) and (110.09,58.54) .. (100.07,84.59) -- (190.88,99.52) -- cycle ; draw   (280.72,84.13) .. controls (269.63,59.54) and (234.2,41.14) .. (191.9,40.41) .. controls (147.56,39.65) and (110.09,58.54) .. (100.07,84.59) ;
%Shape: Arc [id:dp4187809953512516] 
draw  [draw opacity=0] (367.8,83.99) .. controls (356.78,55.41) and (311.89,33.44) .. (257.8,32.51) .. controls (200.75,31.52) and (153.11,54.28) .. (144.43,84.87) -- (256.7,96.28) -- cycle ; draw   (367.8,83.99) .. controls (356.78,55.41) and (311.89,33.44) .. (257.8,32.51) .. controls (200.75,31.52) and (153.11,54.28) .. (144.43,84.87) ;
%Shape: Arc [id:dp5908366205988349] 
draw  [draw opacity=0] (368.35,86.98) .. controls (357.24,52.66) and (302.25,25.86) .. (235.62,24.7) .. controls (167.62,23.53) and (110.8,49.48) .. (100.11,84.48) -- (234.36,98.12) -- cycle ; draw   (368.35,86.98) .. controls (357.24,52.66) and (302.25,25.86) .. (235.62,24.7) .. controls (167.62,23.53) and (110.8,49.48) .. (100.11,84.48) ;

% Text Node
draw (95,135.26) node [anchor=north west][inner sep=0.75pt]    {$0$};
% Text Node
draw (139,135.26) node [anchor=north west][inner sep=0.75pt]    {$1$};
% Text Node
draw (273,133.26) node [anchor=north west][inner sep=0.75pt]    {$4$};
% Text Node
draw (361,133.26) node [anchor=north west][inner sep=0.75pt]    {$6$};
% Text Node
draw (117,87) node [anchor=north west][inner sep=0.75pt]    {$1$};
% Text Node
draw (205,87) node [anchor=north west][inner sep=0.75pt]    {$3$};
% Text Node
draw (319,87) node [anchor=north west][inner sep=0.75pt]    {$2$};
% Text Node
draw (136,50) node [anchor=north west][inner sep=0.75pt]    {$4$};
% Text Node
draw (258,36.26) node [anchor=north west][inner sep=0.75pt]    {$5$};
% Text Node
draw (194,7.26) node [anchor=north west][inner sep=0.75pt]    {$6$};
end{tikzpicture}
  caption{A special drawing.}
end{figure}

end{document}

enter image description here

Answered by Sebastiano on January 31, 2021

A solution with pstricks:

documentclass[border=4pt]{standalone}
usepackage{pst-node, pst-plot}

begin{document}

begin{pspicture}(-0.2,-0.4)(6.2,2.6)sffamily
    psset{dimen=middle, linejoin=1}
    psaxes[yAxis=false, linewidth=0pt, tickstyle=top, labels=none, linejoin=1](0,0)(0,0)(6,1)
    psframe(0,1)(6,0)
    foreach i in {0,1,4,6}{psline(i, 1)(i, 0) uput{3pt}[d](i, 0){i}}
    pnodes{A}(0,1)(1,1)(4,1)(6,1)
    psset{labelsep=1pt}
    ncarc[arcangle=35]{A0}{A2}naput[npos=0.3]{4}
    ncarc[arcangle=55]{A0}{A3}naput{6}
    ncarc[arcangle=45]{A1}{A3}nbput{5}
    psset{linestyle=none}
    ncline{A0}{A1}nbput{1}
    ncline{A1}{A2}nbput{3}
    ncline{A2}{A3}nbput{2}
end{pspicture}

end{document}

enter image description here

Answered by Bernard on January 31, 2021

Just for fun using TiKz.

documentclass[margin=3mm]{standalone}
usepackage{tikz} 
begin{document}
begin{tikzpicture}
 draw (0,0)--(6,0)--(6,1)--(0,1)--cycle;
 foreach x in {1,...,5}{
 draw (x,0)--++(90:0.25);}
 foreach x in {1,4}{
 draw (x,0)--++(90:1);}
 foreach x in {0,1,4,6}{
 node at (x,-0.2){x};}
 foreach x/t in {0.5/1,2.5/3,5/2}{
 node at (x,0.8){t};}
 path (0,1)  edge   [bend left=25]   node[above=1mm, left=6mm] {4} (4,1);
 path (1,1)  edge   [bend left=25]   node[above=1.5mm, left=3mm] {5} (6,1);
 path (0,1)  edge   [bend left=40]   node[above, left=10mm] {6} (6,1);
end{tikzpicture}
end{document}

enter image description here

Answered by ferahfeza on January 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP