更改 tikzpicture 中绘图的位置及其标题

更改 tikzpicture 中绘图的位置及其标题

我想要实现以下目标。参考图附后。

  1. 在图 16.1 中,按照附图中红色突出显示的方式打印 1%。
  2. 将图 6.4 移至左侧(图 16.1 下方)。
  3. 在图6.4右侧添加标题(附图中红框所指空间)。

以下是我的代码

\documentclass[acmsmall]{acmart}
\acmJournal{CSUR}

\usepackage{pgf-pie, etoolbox} 
\usetikzlibrary{shadows}
 \usepackage{color,soul}
 \usepackage{tikz,pgfplots,pgfplotstable}
 \definecolor{cadmiumorange}{rgb}{0.93, 0.53, 0.18}

\begin{document}

\begin{figure*}[h]
\centering
\captionsetup{justification=centering}
\begin{tikzpicture}
[
every node/.style={align=center},
pin distance=9mm,
font={\scriptsize},
scale=0.55
]
%   \pie [text=legend]{
\pie [polar, explode=.1]{
    1/2222,
    9/2222,
    20/2222,
    17/2222,
    24/2222,
    29/2222}
\node (O) at (2,-3.7){(16.1)};
\end{tikzpicture}
\begin{tikzpicture}
[
every node/.style={align=center},
pin distance=9mm,
font={\scriptsize},
scale=0.55
]
%   \pie [text=legend]{
\pie [polar, explode=.1]{
    63/Ccccccccccc,
    30/Rrrrrrrr,
    3/Tttttt,
    4/Ooooo}
\node (O) at (0,-3.7){(16.2)};
\end{tikzpicture}
\begin{tikzpicture}
[
every node/.style={align=center},
pin distance=9mm,
font={\scriptsize},
scale=0.55
]
%   \pie [text=legend]{
\pie [polar, explode=.1]{
    52/Aaaaaaaa,
    17/Iiiiiiii,
    31/Coooooooooooo}       
\node (O) at (0,-3.7){(16.3)};
\end{tikzpicture}   
\begin{tikzpicture}
[
%scale =.5, 
%transform shape,
font={\large},
scale=.5
]
\begin{axis} [
xtick={2016, 2017, 2018, 2019, 2020, 2021},
major x tick style = transparent,
ybar = 2*\pgflinewidth,
bar width=5pt,
%   ymajorgrids = true,
ylabel={Number of Stocks},  
symbolic x coords={2016, 2017, 2018, 2019, 2020, 2021},
scaled y ticks = false,
%   enlarge x limits=0.35,
ymin=0,
minor y tick num=5, 
xlabel style={yshift=-.3cm},
ylabel style={yshift=-.5cm},
tick label style={font=\large},
legend style={at={(.5,-0.1)}, anchor=north, /tikz/every even column/.append style={column sep=.2cm}},
legend columns = -1     
]
\addplot[red!20!black,fill=blue] coordinates {  
    (2016, 1) 
    (2017, 6) 
    (2018, 10)
    (2019, 5)
    (2020, 11)
    (2021, 11)
};
\addplot[red!20!black,fill=yellow] coordinates {    
    (2016, 0) 
    (2017, 0) 
    (2018, 3)
    (2019, 4)
    (2020, 6)
    (2021, 8)
};
\addplot [red!20!black,fill=cadmiumorange] coordinates  {   
    (2016, 0) 
    (2017, 0) 
    (2018, 0)
    (2019, 1)
    (2020, 0)
    (2021, 1)
};
\addplot [red!20!black,fill=cyan] coordinates {
    (2016, 0) 
    (2017, 0) 
    (2018, 1)
    (2019, 2)
    (2020, 0)
    (2021, 0)
};
\legend{Firm1, Firm2, Firm3, Firm4}
\end{axis}
\node (O) at (3.5,-1.7){\scriptsize(6.4)};
\end{tikzpicture}
\caption{Quantitative analysis of research methodology showing various distributions.}
\label{fig:6}
\end{figure*}   
\end{document}

参考图

答案1

我在我的评论中提到了如何实现 OP 请求的第 1 点。对于第 2 点和第 3 点,以下代码可以实现它:

  1. 请参阅对 OP 问题的评论(此处近似)

  2. 明智地使用来\hfill克服\centering

  3. 放置\captionminipage

一般来说,提出一个单一观点的问题,而不是提出 3 个独立问题,更有可能得到答复。

以下是代码:

\documentclass[acmsmall]{acmart}
\acmJournal{CSUR}

\usepackage{pgf-pie, etoolbox} 
\usetikzlibrary{shadows}
 \usepackage{color,soul}
 \usepackage{tikz,pgfplots,pgfplotstable}
 \definecolor{cadmiumorange}{rgb}{0.93, 0.53, 0.18}

\begin{document}

\begin{figure*}[h]
\centering
\captionsetup{justification=centering}
\begin{tikzpicture}
[
every node/.style={align=center},
pin distance=9mm,
font={\scriptsize},
scale=0.55
]
%   \pie [text=legend]{
\pie [polar, explode=.1]{
    1/\!1\%~~2222,
    9/2222,
    20/2222,
    17/2222,
    24/2222,
    29/2222}
\pie [sum=6, hide number,explode=.1,radius=.55]{1/}
\node (O) at (2,-3.7){(16.1)};
\end{tikzpicture}
\begin{tikzpicture}
[
every node/.style={align=center},
pin distance=9mm,
font={\scriptsize},
scale=0.55
]
%   \pie [text=legend]{
\pie [polar, explode=.1]{
    63/Ccccccccccc,
    30/Rrrrrrrr,
    3/Tttttt,
    4/Ooooo}
\node (O) at (0,-3.7){(16.2)};
\end{tikzpicture}
\begin{tikzpicture}
[
every node/.style={align=center},
pin distance=9mm,
font={\scriptsize},
scale=0.55
]
%   \pie [text=legend]{
\pie [polar, explode=.1]{
    52/Aaaaaaaa,
    17/Iiiiiiii,
    31/Coooooooooooo}       
\node (O) at (0,-3.7){(16.3)};
\end{tikzpicture}   
\begin{tikzpicture}
[
%scale =.5, 
%transform shape,
font={\large},
scale=.5
]
\begin{axis} [
xtick={2016, 2017, 2018, 2019, 2020, 2021},
major x tick style = transparent,
ybar = 2*\pgflinewidth,
bar width=5pt,
%   ymajorgrids = true,
ylabel={Number of Stocks},  
symbolic x coords={2016, 2017, 2018, 2019, 2020, 2021},
scaled y ticks = false,
%   enlarge x limits=0.35,
ymin=0,
minor y tick num=5, 
xlabel style={yshift=-.3cm},
ylabel style={yshift=-.5cm},
tick label style={font=\large},
legend style={at={(.5,-0.1)}, anchor=north, /tikz/every even column/.append style={column sep=.2cm}},
legend columns = -1     
]
\addplot[red!20!black,fill=blue] coordinates {  
    (2016, 1) 
    (2017, 6) 
    (2018, 10)
    (2019, 5)
    (2020, 11)
    (2021, 11)
};
\addplot[red!20!black,fill=yellow] coordinates {    
    (2016, 0) 
    (2017, 0) 
    (2018, 3)
    (2019, 4)
    (2020, 6)
    (2021, 8)
};
\addplot [red!20!black,fill=cadmiumorange] coordinates  {   
    (2016, 0) 
    (2017, 0) 
    (2018, 0)
    (2019, 1)
    (2020, 0)
    (2021, 1)
};
\addplot [red!20!black,fill=cyan] coordinates {
    (2016, 0) 
    (2017, 0) 
    (2018, 1)
    (2019, 2)
    (2020, 0)
    (2021, 0)
};
\legend{Firm1, Firm2, Firm3, Firm4}
\end{axis}
\node (O) at (3.5,-1.7){\scriptsize(6.4)};
\end{tikzpicture}\hfill\hbox{}
\begin{minipage}[b]{.6\textwidth}
\caption{Quantitative analysis of research methodology showing various distributions.}
\label{fig:6}
\vspace{50pt}
\end{minipage}
\end{figure*} 

Following text
\end{document}

在此处输入图片描述

相关内容