10

I want to create following figure using tikz I want to create following figure using tikz

I have tried the following codes:

\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}

I have created this with the help of above codes.

I have created following figure

  • 1
    Welcome to TeX.SX! You can highlight code in your post using back-ticks. To highlight code-blocks, either indent them by four spaces or use the {} on the gui. Also, can you please expand the code snippets that you have posted to a full minimal working example. It is much easier to help you you if we can start with some compilable code that illustrates your problem. A MWE should start with a \documentclass command, include any necessary packages and be as small as possible to demonstrate your problem. Ideally it should compile. – Andrew Feb 19 '18 at 6:35
17

I think it's easier with some predefined nodes (circle, semicircle), and some other libraries like intersections and positioning to build the scheme.

What I don't know how to do is the 3d shadowing aspect.

\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}

enter image description here

14

Ignasi's excellent answer plus a few shadows.

\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}

enter image description here

UPDATE: Minor improvement of the circle. (The source of the png can be found here.)

EDIT: Is this the part you wanted to remove?

\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}

enter image description here

  • I want to have five more different but same style figures and want to remove some extra part of top left corner. – Muhammad Ali Baig Feb 21 '18 at 5:23
  • @MuhammadAliBaig Could you please be more specific? What extra part do you wish to get removed? – marmot Feb 21 '18 at 5:25
  • Yes I want remove that part. – Muhammad Ali Baig Feb 22 '18 at 15:19
  • @MuhammadAliBaig OK, in the second example it is removed... – marmot Feb 22 '18 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.