使用 LaTeX 繪製圖表(智慧藝術)

使用 LaTeX 繪製圖表(智慧藝術)

我想創建下圖: 在此輸入影像描述

我嘗試過以下程式碼:

\begin{figure}
\begin{tikzpicture}[scale=1, transform shape]
%\draw[step=0.5cm,gray,very thin] (0,0) grid (12,6);
\node (i) at (1.5,2.5) {\small\textbf{Somoza's Dictatorship}};
\node (ii) at (4.5,5.5) {\small\textbf{Sandinista Revolution}};
\node (iii) at (8,2.5) {\small\textbf{Neoliberalism}};
\node (iv) at (11,5.5) {\small\textbf{Hybrid Model}};
\node (a) at (1.5,4) {1936-1979};
\node (b) at (4.5,2) {1979-1990};
\node (c) at (8,4) {1990-2007};
\node (d) at (11,2) {2007-Present};
\end{tikzpicture}
\caption{Political Context of Nicaragua.}
\end{figure} 

但是,我不知道如何包含圓圈、顏色和項目符號。我的結果如下圖所示。還有其他方法嗎?我發現我的程式碼太困難和混亂。

在此輸入影像描述

最好的問候,羅尼。

答案1

如果設定text width節點的 ,則可以itemize在節點內使用標準清單。要製作一個大圓圈,請draw,circle,line width=2.5mm在選項中使用例如建立一個節點。

如果您使用該positioning庫並將節點相對放置,則定位這些節點會更容易。例如,如果有\node (a) {...};,那麼您可以透過說 來將節點放置b在其下方\node [below=of a] (b) {...};

這是一個例子,我在程式碼中添加了一些註解:

在此輸入影像描述

\documentclass{beamer}
\usetheme{metropolis}
\usepackage{ragged2e}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{frame}[fragile]
\frametitle{Intro}
\begin{tikzpicture}[
 bigcircle/.style={ % style for the circles
    text width=1.6cm, % diameter
    align=center, % center align
    line width=2mm, % thickness of border
    draw, % draw the border
    circle, % shape
    font=\sffamily\footnotesize % font of the year
  },
 desc/.style 2 args={ % style for the list nodes
   % this style takes two mandatory arguments, as indicated by "2 args", so is used as
   % desc={first arg}{second arc}
   % the first arg is the color of the title/heading, the second is the title itself
  text width=2.5cm, % means the node will be kind of like a 4cm wide minipage, and if the
                  % text in the node becomes wider than that, it will wrap to the next line
  font=\sffamily\scriptsize\RaggedRight, % set the font in the list
  label={[#1,yshift=-1.5ex,font=\sffamily\footnotesize]above:#2} % add the title as a label
  },
 node distance=10mm and 2mm % vertical and horizontal separation of nodes, when positioned with e.g. above=of othernode
]

\node [bigcircle] (circ1) {1936--1979};
\node [desc={black}{Somoza's dictatorship},below=of circ1] (list1) {
\begin{itemize}
\setlength\itemsep{0pt} % reduce space between items in list
\item Point 1
\item Point 2
\item Point 3
\item Point 4
\end{itemize}
};

\node [bigcircle,red,right=of list1] (circ2) {1979--1990};
\node [desc={red}{Sandinista Revolution},above=of circ2] (list2) {
\begin{itemize}
\setlength\itemsep{0pt}
\item Point 1
\item Point 2
\item Point 3
\item Point 4
\end{itemize}
};

\node [bigcircle,blue!60!red,right=of list2] (circ3) {1990--2007};
\node [desc={blue!60!red}{Neoliberalism},below=of circ3] (list3) {
\begin{itemize}
\setlength\itemsep{0pt}
\item Point 1
\item Point 2
\item Point 3
\item Point 4
\end{itemize}
};

\node [bigcircle,gray,right=of list3] (circ4) {2007--Present};
\node [desc={gray}{Hybrid model},above=of circ4] (h) {
\begin{itemize}
\setlength\itemsep{0pt}
\item Point 1
\item Point 2
\item Point 3
\item Point 4
\end{itemize}
};

% draw the line between circles
\draw [dashed,black!80] (circ1) -- (circ2) -- (circ3) -- (circ4);
\end{tikzpicture} 
\end{frame}
\end{document}

答案2

遵循@TorbjørnT 的建議:

因為我正在做一個beamer文檔。我加\begin{frame}[fragile]{Introduction: Political Context Of Nicaragua}。另外我修改了比例scale=0.9, transform shape。我得到了這個: 在此輸入影像描述

font=\sffamily\scriptsize\RaggedRight在此輸入影像描述

相關內容