Как создать следующую фигуру с помощью TikZ

Как создать следующую фигуру с помощью TikZ

Я хочу создать следующую фигуру с помощью tikz Я хочу создать следующую фигуру с помощью tikz

Я попробовал следующие коды:

\documentclass{standalone}

    \usepackage{tikz}

    \begin{document}

    \begin{tikzpicture}

      \draw(0,0) circle (1);

      \filldraw[pink] (-1,0) rectangle (9,1);

      \filldraw[pink] (9.25,0.3) ellipse (0.9cm and 0.7cm);

      \node at (0,0.5) {\footnotesize{$127^{th}$}};

      \node at (0,-0.5) {\footnotesize{World}};

      \node at (4.9,0.75) {\footnotesize{Shanghai Ranking}};

      \node at (4.9,0.25) {\footnotesize{(China)}};

      \node at (9.25,0.35) {\footnotesize{$2017$}};

    \end{tikzpicture}
\end{document}

Я создал это с помощью приведенных выше кодов.

Я создал следующую фигуру

решение1

Превосходный ответ Игнаси плюс несколько теней.

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{shapes.geometric, positioning,
intersections,calc,shadows,shapes,fit,fadings}
\usetikzlibrary{backgrounds}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
\usetikzlibrary{shadows.blur}
\tikzset{% from https://tex.stackexchange.com/a/287177/121799
  my blur shadow layer/.style={
    preaction={fill=black,fill opacity=.025,transform canvas={xshift=0,yshift=#1}},
  },
  my blur shadow/.style={
    my blur shadow layer/.list={.3pt,.6pt,...,4.8pt},
  },
}
\makeatletter%from https://tex.stackexchange.com/a/245444/121799
\pgfdeclareradialshading{tikz@lib@fade@circle@5}{\pgfpointorigin}{%
  color(0pt)=(pgftransparent!0); color(18.75bp)=(pgftransparent!0);%
  color(22bp)=(pgftransparent!100); color(40bp)=(pgftransparent!100)%
}
\pgfdeclarefading{circle with fuzzy edge 5 percent}{%
  \pgfuseshading{tikz@lib@fade@circle@5}%
}
\pgfdeclareradialshading{tikz@lib@fade@circle@2}{\pgfpointorigin}{%
  color(0pt)=(pgftransparent!100); color(18.75bp)=(pgftransparent!100);%
  color(22bp)=(pgftransparent!0); color(40bp)=(pgftransparent!0)%
}
\pgfdeclarefading{circle with fuzzy edge 2 percent}{%
  \pgfuseshading{tikz@lib@fade@circle@2}%
}
\makeatother
\begin{document}
% \tikzset{every shadow/.style={shadow yshift=.5ex,shadow xshift=0pt,
% shadow scale=1}}
%\tikzset{every shadow/.style={shadow scale=1}}
\begin{tikzpicture}

      \node[draw=pink,fill=pink, minimum width=9cm, minimum height=1.5cm, 
      align=center, text width=3cm, text=white, font=\bfseries\sffamily,
       name path=SRp,my blur shadow]
      (SR)
      {Shanghai Ranking\\(China)};
      \node[left=-0.5pt of SR,minimum width=1.5cm, minimum height=1.5cm,
      fill=white,my blur shadow]{};
\begin{pgfonlayer}{foreground}
      \node[
            semicircle, 
            fill=pink, 
            minimum width=3cm,
            draw=pink!80!black, 
            text=white,
            font=\sffamily\bfseries, 
            below=0pt of SR.north west
            ] 
            (127) 
            {127\textsuperscript{th}};

      \node[fill=white,
            semicircle, 
            shape border rotate=180,
            minimum width=3cm,
            draw=pink!80!black, 
            font=\sffamily\bfseries, 
            below=0pt of 127.south
            ] 
            (world) 
            {World};
\begin{scope}
    \clip ($(127)!0.5!(world)$) circle (1.5cm);
    \draw[draw=none,circular glow=
    {path fading={circle with fuzzy edge 2 percent}}] ($(127)!0.5!(world)$)
    circle (1.35cm);
    \draw[line width=0.5mm,pink] ($(127)!0.5!(world)+(1.475cm,0)$) arc (0:180:1.475cm);
    \draw[line width=0.5mm,white] ($(127)!0.5!(world)+(1.475cm,0)$) arc (0:-180:1.475cm);
\end{scope} 
\end{pgfonlayer}    
    \draw[draw=none,circular glow=
    {path fading={circle with fuzzy edge 5 percent}}] ($(127)!0.5!(world)$) circle (1.5cm);
\begin{pgfonlayer}{background}
          \node[circle,fill=pink, minimum size=2.25cm, text=white,
            font=\sffamily\bfseries, right=-3mm of SR.east, name path =2017p,
            ,circular glow=
    {path fading={circle with fuzzy edge 5 percent}}] (2017) 
            {2017};
        \fill[red, name intersections={of=2017p and SRp}];
\end{pgfonlayer}    

        \fill[my blur shadow,
        fill=white]
        ($(intersection-2)-(0,1cm)$) rectangle ($(world.45)+(1.04cm,0)$);

%\begin{pgfonlayer}{background}
      \node[rectangle split,  rectangle split horizontal, 
         rectangle split parts=2, align=left, inner sep =1pt, %text width=4cm, 
      font=\scriptsize\bfseries\sffamily,
      below right= 0mm and 2mm of 127.arc start]
      (tabular)
      {\begin{tabular}{ll}
            \multicolumn{2}{l}{Agricultural Sciences}\\
            World: & 127\textsuperscript{th} out of 500\\
            Asia: & 21\textsuperscript{st} out of 106\\
            Pakistan: & 1\textsuperscript{st} out of 1
        \end{tabular}\nodepart{two}\includegraphics[height=1cm]{ARWU.png}};
%\end{pgfonlayer}   

        \draw[gray] (intersection-2) |- (world.apex);
    \end{tikzpicture}
\end{document}

введите описание изображения здесь

ОБНОВЛЯТЬ: Незначительное улучшение круга. (Источник png можно найтиздесь.)

РЕДАКТИРОВАТЬ: Это та часть, которую вы хотели удалить?

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{shapes.geometric, positioning,
intersections,calc,shadows,shapes,fit,fadings}
\usetikzlibrary{backgrounds}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
\usetikzlibrary{shadows.blur}
\tikzset{% from https://tex.stackexchange.com/a/287177/121799
  my blur shadow layer/.style={
    preaction={fill=black,fill opacity=.025,transform canvas={xshift=0,yshift=#1}},
  },
  my blur shadow/.style={
    my blur shadow layer/.list={.3pt,.6pt,...,4.8pt},
  },
}
\makeatletter%from https://tex.stackexchange.com/a/245444/121799
\pgfdeclareradialshading{tikz@lib@fade@circle@5}{\pgfpointorigin}{%
  color(0pt)=(pgftransparent!0); color(18.75bp)=(pgftransparent!0);%
  color(22bp)=(pgftransparent!100); color(40bp)=(pgftransparent!100)%
}
\pgfdeclarefading{circle with fuzzy edge 5 percent}{%
  \pgfuseshading{tikz@lib@fade@circle@5}%
}
\pgfdeclareradialshading{tikz@lib@fade@circle@2}{\pgfpointorigin}{%
  color(0pt)=(pgftransparent!100); color(18.75bp)=(pgftransparent!100);%
  color(22bp)=(pgftransparent!0); color(40bp)=(pgftransparent!0)%
}
\pgfdeclarefading{circle with fuzzy edge 2 percent}{%
  \pgfuseshading{tikz@lib@fade@circle@2}%
}
\makeatother
\begin{document}
% \tikzset{every shadow/.style={shadow yshift=.5ex,shadow xshift=0pt,
% shadow scale=1}}
%\tikzset{every shadow/.style={shadow scale=1}}
\begin{tikzpicture}
\begin{scope}
      \node[draw=pink,fill=pink, minimum width=9cm, minimum height=1.5cm, 
      align=center, text width=3cm, text=white, font=\bfseries\sffamily,
       name path=SRp,my blur shadow,anchor=north west]
      (SR) at (0,0)
      {Shanghai Ranking\\(China)};
\end{scope}   
%       \node[left=-0.5pt of SR,minimum width=1.5cm, minimum height=1.5cm,
%       fill=white,my blur shadow]{};
\begin{pgfonlayer}{foreground}
      \node[
            semicircle, 
            fill=pink, 
            minimum width=3cm,
            draw=pink!80!black, 
            text=white,
            font=\sffamily\bfseries, 
            below=0pt of SR.north west
            ] 
            (127) 
            {127\textsuperscript{th}};

      \node[fill=white,
            semicircle, 
            shape border rotate=180,
            minimum width=3cm,
            draw=pink!80!black, 
            font=\sffamily\bfseries, 
            below=0pt of 127.south
            ] 
            (world) 
            {World};
\begin{scope}
%   \draw[fill=white] ($(127)!0.5!(world)+(70:1.5)$) rectangle ++(-2,0.2);
    \clip ($(127)!0.5!(world)$) circle (1.5cm);
    \draw[draw=none,circular glow=
    {path fading={circle with fuzzy edge 2 percent}}] ($(127)!0.5!(world)$)
    circle (1.35cm);
    \draw[line width=0.5mm,pink] ($(127)!0.5!(world)+(1.475cm,0)$) arc (0:180:1.475cm);
    \draw[line width=0.5mm,white] ($(127)!0.5!(world)+(1.475cm,0)$) arc (0:-180:1.475cm);
\end{scope} 
\end{pgfonlayer}    
    \draw[draw=none,circular glow=
    {path fading={circle with fuzzy edge 5 percent}}] ($(127)!0.5!(world)$) circle (1.5cm);
\begin{pgfonlayer}{background}
          \node[circle,fill=pink, minimum size=2.25cm, text=white,
            font=\sffamily\bfseries, right=-3mm of SR.east, name path =2017p,
            ,circular glow=
    {path fading={circle with fuzzy edge 5 percent}}] (2017) 
            {2017};
        \fill[red, name intersections={of=2017p and SRp}];
\end{pgfonlayer}    

        \fill[my blur shadow,
        fill=white]
        ($(intersection-2)-(0,1cm)$) rectangle ($(world.45)+(1.04cm,0)$);

%\begin{pgfonlayer}{background}
      \node[rectangle split,  rectangle split horizontal, 
         rectangle split parts=2, align=left, inner sep =1pt, %text width=4cm, 
      font=\scriptsize\bfseries\sffamily,
      below right= 0mm and 2mm of 127.arc start]
      (tabular)
      {\begin{tabular}{ll}
            \multicolumn{2}{l}{Agricultural Sciences}\\
            World: & 127\textsuperscript{th} out of 500\\
            Asia: & 21\textsuperscript{st} out of 106\\
            Pakistan: & 1\textsuperscript{st} out of 1
        \end{tabular}\nodepart{two}\includegraphics[height=1cm]{ARWU.png}};
%\end{pgfonlayer}   

        \draw[gray] (intersection-2) |- (world.apex);
    \end{tikzpicture}
\end{document}

введите описание изображения здесь

решение2

Я думаю, что проще построить схему с помощью некоторых предопределенных узлов (круг, полукруг) и некоторых других библиотек, таких как intersectionsи .positioning

Чего я не знаю, так это как сделать 3D-тени.

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{shapes.geometric, positioning, intersections}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

      \node[fill=pink, minimum width=9cm, minimum height=1.5cm, 
      align=center, text width=3cm, text=white, font=\bfseries\sffamily,
       name path=SRp]
      (SR)
      {Shangay Ranking\\(China)};

      \node[
            semicircle, 
            fill=pink, 
            minimum width=3cm,
            draw=pink!80!black, 
            text=white,
            font=\sffamily\bfseries, 
            below=0pt of SR.north west
            ] 
            (127) 
            {127\textsuperscript{th}};

      \node[
            semicircle, 
            shape border rotate=180,
            minimum width=3cm,
            draw=pink!80!black, 
            font=\sffamily\bfseries, 
            below=0pt of 127.south
            ] 
            (world) 
            {World};

          \node[circle,fill=pink, minimum size=2.25cm, text=white,
            font=\sffamily\bfseries, right=-3mm of SR.east, name path =2017p] (2017) 
            {2017};

            \fill[red, name intersections={of=2017p and SRp}];
%               (intersection-1) circle (2pt) node[right] {1}
%               (intersection-2) circle (2pt) node[right] {2};

      \node[align=left, text width=3cm, 
      font=\scriptsize\bfseries\sffamily,
      below right= 0mm and 2mm of 127.arc start]
      (tabular)
      {\begin{tabular}{ll}
            \multicolumn{2}{l}{Agricultural Sciences}\\
            World: & 127\textsuperscript{th} out of 500\\
            Asia: & 21\textsuperscript{st} out of 106\\
            Pakistan: & 1\textsuperscript{st} out of 1
        \end{tabular}};

        \node[inner sep=0pt, right=2cm of tabular] (logo) {\includegraphics[height=1.2cm]{example-image}};

        \draw[gray] (intersection-2) |- (world.apex);
    \end{tikzpicture}
\end{document}

введите описание изображения здесь

Связанный контент