我是新手,刚开始用 LaTeX 画图。我想用 LaTeX 画出下面的图表用于我的 Beamer 演示,但我觉得有点难。有人能帮忙吗?
这是我目前能够做的事情:
\documentclass[12pt,serif]{beamer}
\mode<presentation>{\usetheme{CambridgeUS}}
\usecolortheme{seahorse}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[charter]{mathdesign}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\draw[blue,thick] (15,15) ++(45:1) arc (45:-45:4);
\filldraw[blue,thick] (16.2,15) circle(0.5cm);
\draw[blue,thick] (16.2,15) rectangle(25cm,5);
\end{tikzpicture}
\end{frame}
\end{document}
我并不介意颜色不同。谢谢
答案1
边框颜色和圆圈填充可以根据您的喜好进行简单调整。为了保持代码的简单性,矩形的颜色(迄今为止)是固定的:
\documentclass{beamer}
\mode<presentation>{\usetheme{CambridgeUS}}
\usecolortheme{seahorse}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
%\usepackage[charter]{mathdesign} % i haven't installed
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{frame}[fragile]
\begin{tikzpicture}[
C/.style = {circle,
draw=#1, thick,
fill=#1!30,
minimum size=12mm
},
R/.style = {rectangle,
draw=gray, thick,
fill=gray!30,
minimum height=9mm,
text width=12cm-#1cm,
inner xsep=8mm,
align=left,
font=\Large,
anchor=west
}
]
%
\draw[gray, line width=2mm] ( 60:4) arc (60:-60:4);
%
\node[R=2.83] at ( 45:4) {Agra}; % 4*cos(45)
\node[R=3.86] at ( 15:4) {Fran}; % 4*cos(15)
\node[R=3.86] at (-15:4) {Brana};% 4*cos(15)
\node[R=2.83] at (-45:4) {Grad}; % 4*cos(45)
%
\node[C=blue] at ( 45:4) {};
\node[C=green] at ( 15:4) {};
\node[C=olive] at (-15:4) {};
\node[C=gray] at (-45:4) {};
\end{tikzpicture}
\end{frame}
\end{document}
补充: 对上面的例子进行一些小的改动,可以对矩形进行简单的着色:
\documentclass{beamer}
\mode<presentation>{\usetheme{CambridgeUS}}
\usecolortheme{seahorse}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
%\usepackage[charter]{mathdesign}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{frame}[fragile]
\begin{tikzpicture}[
C/.style = {% Circle
circle,
draw=#1, thick,
fill=#1!30,
minimum size=11mm
},
R/.style args = {#1:#2}{% Rectangle <---
rectangle, rounded corners, % <---
draw=#2, very thin,
top color= #2!20, % <---
bottom color= #2!20, % <---
middle color= #2!60, % <---
minimum height=9mm,
text width=12cm-#1cm,
inner xsep=9mm,
align=left,
font=\Large,
anchor=west
},
]
%
\draw[gray, line width=2mm] ( 60:4) arc (60:-60:4);
%
\node[R=2.83:blue] at ( 45:4) {Agra}; % 4*cos(45)
\node[R=3.86:green] at ( 15:4) {Fran}; % 4*cos(15)
\node[R=3.86:olive] at (-15:4) {Brana};% 4*cos(15)
\node[R=2.83:gray] at (-45:4) {Grad}; % 4*cos(45)
%
\node[C=blue] at ( 45:4) {};
\node[C=green] at ( 15:4) {};
\node[C=olive] at (-15:4) {};
\node[C=gray] at (-45:4) {};
\end{tikzpicture}
\end{frame}
\end{document}
答案2
该smartdiagram
包可以做类似的事情:
\documentclass{beamer}
\usepackage{smartdiagram}
\begin{document}
\begin{frame}
\begin{center}
\smartdiagram[descriptive diagram]
{
{, Agra},
{, Fran},
{, Bran},
{, Grad},
}
\end{center}
\end{frame}
\end{document}