使用 pgfplots 在 y 轴上绘制图形

使用 pgfplots 在 y 轴上绘制图形

我有一张图表,我想在 Y 轴上绘制图形而不是数字或文本。

我的代码如下:

\begin{tikzpicture} 
\begin{axis}
[ 
xbar, xmin=0, xmax=10, 
width=7cm, height=8cm, enlarge y limits=0.5, 
xlabel={Closeness to the base firm}, 
symbolic y coords={
    \includegraphics[scale=0.022]{Logo/intellogo.png},
    \includegraphics[scale=0.02]{Logo/HPlogo.png},
    \includegraphics[scale=0.02]{Logo/nvidialogo.png},
    \includegraphics[scale=0.03]{Logo/broadcomlogo.png},
    \includegraphics[scale=0.035]{Logo/texasinstrumentslogo.png},
    \includegraphics[scale=0.055]{Logo/googlelogo.png},
    \includegraphics[scale=0.14]{Logo/microsoftlogo4.png}
    },
ytick=data, 
nodes near coords, nodes near coords align={horizontal}] 
\addplot[xbar,fill={rgb:red,0;green,47;blue,135}] coordinates {
(10, \includegraphics[scale=0.022]{Logo/intellogo.png})
(9, \includegraphics[scale=0.02]{Logo/HPlogo.png})
(8, \includegraphics[scale=0.02]{Logo/nvidialogo.png})
(7, \includegraphics[scale=0.03]{Logo/broadcomlogo.png})
(6, \includegraphics[scale=0.035]{Logo/texasinstrumentslogo.png})
(5, \includegraphics[scale=0.055]{Logo/googlelogo.png})
(4, \includegraphics[scale=0.14]{Logo/microsoftlogo4.png})
}; 
\end{axis} 
\end{tikzpicture}

目前看起来是这样的:

在此处输入图片描述

我希望所有徽标按照本\addplot {}节中提到的 y 值的顺序显示在 Y 轴上

答案1

我设法让它工作了。我删除了放大 y 限制。显然,它使它们相互重叠。

\begin{tikzpicture} 
\begin{axis}
[ 
xbar, xmin=0, xmax=8,
width=7cm, height=10cm,
xlabel={Closeness to the base firm}, 
symbolic y coords={
    \includegraphics[scale=0.022]{Logo/intellogo.png},
    \includegraphics[scale=0.02]{Logo/HPlogo.png},
    \includegraphics[scale=0.02]{Logo/nvidialogo.png},
    \includegraphics[scale=0.03]{Logo/broadcomlogo.png},
    \includegraphics[scale=0.035]{Logo/texasinstrumentslogo.png},
    \includegraphics[scale=0.055]{Logo/googlelogo.png},
    \includegraphics[scale=0.14]{Logo/microsoftlogo4.png}
    },
ytick=data, 
nodes near coords, nodes near coords align={horizontal}] 
\addplot[xbar,fill={rgb:red,0;green,47;blue,135}] coordinates 
{
(8,\includegraphics[scale=0.022]{Logo/intellogo.png})
(7,\includegraphics[scale=0.02]{Logo/HPlogo.png})
(6,\includegraphics[scale=0.02]{Logo/nvidialogo.png})
(5,\includegraphics[scale=0.03]{Logo/broadcomlogo.png})
(4,\includegraphics[scale=0.035]{Logo/texasinstrumentslogo.png})
(3,\includegraphics[scale=0.055]{Logo/googlelogo.png})
(2,\includegraphics[scale=0.14]{Logo/microsoftlogo4.png})
}; 
\end{axis} 
\end{tikzpicture}

现在看起来正确了: 在此处输入图片描述

相关内容