將色條放入子浮點數組中

將色條放入子浮點數組中

我創建了一個子浮點數組,它顯示我使用 matlab 生成的不同熱圖。這非常有效,直到我想包含用 tikz 產生的色條。在此輸入影像描述

我知道我的方法行不通,但我不知道該怎麼做。以下是我產生您在上面看到的內容的方法:

\documentclass[12pt,a4paper, table]{report}

\usepackage{graphicx}
\usepackage{tikz,pgfplots}
\usepackage{tikz}
\usepackage{float}
\usetikzlibrary{shapes,arrows,shapes.multipart,positioning,decorations.text,fit}
\usepackage{lipsum}
\usepackage{tikz,pgfplots}
\usepackage{graphicx}
\usepackage{psfrag}
\usepackage{subfig}
\usepackage{subcaption}



\begin{document}%****************************************************

\begin{figure}[htp]
  \centering
  \subfloat[][]{\label{figur:1}\includegraphics[width=3cm]{Depth_n_10m_cy_0_rot_0.png}}
  \quad
  \subfloat[][]{\label{figur:2}\includegraphics[width=3cm]{Depth_n_10m_cy_3_rot_0.png}}
  \quad
  \fbox{\subfloat[][]{\label{figur:3}\includegraphics[width=3cm]{Depth_n_10m_cy_6_rot_0.png}}
 \begin{tikzpicture}
\begin{axis}[
    at={(-3,-0.5)},
%     hide axis,
%     scale only axis,
    height=0pt,
    width=0pt,
    colormap/jet,
      colorbar,
    point meta min=0,
    point meta max=10,
    colorbar style={
        height=0.20\textwidth,                 % Höhe der Colorbar
       xtick={2,4,6,8,10}
    }]
%     \addplot [] {};
    \end{axis}
\end{tikzpicture}}
  \\
  \subfloat[][]{\label{figur:4}\includegraphics[width=3cm]{Depth_n_10m_cy_0_rot_-0_1.png}}
  \quad
  \subfloat[][]{\label{figur:5}\includegraphics[width=3cm]{Depth_n_10m_cy_3_rot_-0_1.png}}
  \quad
  \subfloat[][]{\label{figur:6}\includegraphics[width=3cm]{Depth_n_10m_cy_6_rot_-0_1.png}}
  \\
  \subfloat[][]{\label{figur:7}\includegraphics[width=3cm]{Depth_n_10m_cy_0_rot_-0_2.png}}
  \quad
  \subfloat[][]{\label{figur:8}\includegraphics[width=3cm]{Depth_n_10m_cy_3_rot_-0_2.png}}
  \quad
  \subfloat[][]{\label{figur:9}\includegraphics[width=3cm]{Depth_n_10m_cy_6_rot_-0_2.png}}
  \label{fig:sensitivity towards pose}
  \caption{Figure}
  \end{figure}
\end{document} %******

我打算將色條與第一行影像垂直對齊,該怎麼做?

答案1

這不是您問題的解決方案,而是可以避免垂直對齊問題的替代分佈。

不要使用垂直格式的顏色圖,而是將其水平放置在圖形頂部。

\documentclass[12pt,a4paper, table]{report}

\usepackage{graphicx}
\usepackage{tikz,pgfplots}
\usepackage{tikz}
\usepackage{float}
\usetikzlibrary{shapes,arrows,shapes.multipart,positioning,decorations.text,fit}
\usepackage{lipsum}
\usepackage{tikz,pgfplots}
\usepackage{graphicx}
\usepackage{psfrag}
\usepackage{subfig}
%\usepackage{subcaption}

\begin{document}

\begin{figure}[htp]
  \centering
  \begin{tabular}{ccc}
\multicolumn{3}{c}{\begin{tikzpicture}
\begin{axis}[
    at={(-3,-0.5)},
     hide axis,
     scale only axis,
    height=0pt,
    width=5cm,
    colormap/jet,
      colorbar horizontal,
    point meta min=0,
    point meta max=10,
    colorbar style={
%        height=0.20\textwidth,                 % Höhe der Colorbar
       xtick={2,4,6,8,10}
    }]
%     \addplot [] {};
    \end{axis}
\end{tikzpicture}}\\
                        \subfloat[][]{\label{figur:1}\includegraphics[width=3cm]{example-image}}
  &
  \subfloat[][]{\label{figur:2}\includegraphics[width=3cm]{example-image}}
  &
  \subfloat[][]{\label{figur:3}\includegraphics[width=3cm]{example-image}}\\
  \subfloat[][]{\label{figur:4}\includegraphics[width=3cm]{example-image}}
  &
  \subfloat[][]{\label{figur:5}\includegraphics[width=3cm]{example-image}}
  &
  \subfloat[][]{\label{figur:6}\includegraphics[width=3cm]{example-image}}
  \\
  \subfloat[][]{\label{figur:7}\includegraphics[width=3cm]{example-image}}
  &
  \subfloat[][]{\label{figur:8}\includegraphics[width=3cm]{example-image}}
  &
  \subfloat[][]{\label{figur:9}\includegraphics[width=3cm]{example-image}}
  \end{tabular}
  \label{fig:sensitivity towards pose}
  \caption{Figure}
  \end{figure}
  \end{document}

在此輸入影像描述

答案2

我遇到了同樣的問題,Gonzalo Medina 提出了一個非常有用的解決方案 這個話題

值得檢查一下。特別是,如果需要一個垂直色條和一些子圖,就像馬丁在這裡問的那樣。

相關內容