1)绘图不居中

1)绘图不居中

我对这幅图有两个疑问:

  1. 绘图并不居中,如下图所示(参见红线)。
  2. 为了将$\lambda_\mathrm{acc}$它放置在原来的位置(见图),我预计它的坐标大致位于(0.5,0.5);但为什么它却位于(2,0.5)

    \documentclass[11pt,a4paper]{article}
    \usepackage[T1]{fontenc}                
    \usepackage[utf8]{inputenc}             
    \usepackage[english,italian]{babel}
    \usepackage{graphicx}
    \usepackage{caption}                    
    \usepackage{amsmath,amssymb,amsthm}
    \usepackage{tikz}
        \usetikzlibrary{shapes.arrows}
    \usepackage[%bindingoffset=1.5cm, 
    left=3cm, right=3cm, top=3cm, bottom=3cm]{geometry}
    
    \begin{document}
    
    \title{Title}
    \author{Author} 
    \date{22 dicembre 2015}
    
    \maketitle
    
    \begin{figure}
      \centering
        \begin{tikzpicture}
        \draw [help lines] (0,0) grid (10,10);
        \draw [] (0,0) rectangle (6,1); %acciaio
        \draw [] (0,4.5) rectangle (6,5.5); %piastra impingement
        \node [text width=3cm,font=\footnotesize] at (2,0.5) {$\lambda_\mathrm{acc}$};
        \node [text width=3cm,font=\footnotesize] at (7.6,5) {piastra\\impingement};
        \draw [latex-latex]  (-0.2,0) -- (-0.2,1) node [black,midway,xshift=-0.4cm]{s\ped{acc}};;
        \end{tikzpicture}
        \caption{Distribuzione puntuale di Nusselt per $Re=5000$}\label{fig:Nu_Re5000}
    \end{figure}
    \end{document}
    

完成绘图

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}                
\usepackage[utf8]{inputenc}             
\usepackage[english,italian]{babel}
\usepackage{graphicx}
\usepackage{caption}                    
\usepackage{amsmath,amssymb,amsthm}
\usepackage{xcolor}
    \colorlet{ColorPink}{red!10}
\usepackage{tikz}
    \usetikzlibrary{shapes.arrows}
    \usetikzlibrary{decorations.pathreplacing} %curly bracket
\usepackage[%bindingoffset=1.5cm, 
left=3cm, right=3cm, top=3cm, bottom=3cm]{geometry}

\begin{document}

\title{Title}
\author{Author} 
\date{22 dicembre 2015}

\maketitle

\begin{figure}
  \centering
    \begin{tikzpicture}
    \draw [help lines] (0,0) grid (10,10);
    \draw [fill=blue!30] (0,0) rectangle (6,1); %acciaio
    \draw [fill=blue!15] (0,1) rectangle (6,1.8); %biadesivo
    \draw [fill=gray!10] (0,1.8) rectangle (6,2.3); %inconel
    \draw [fill=blue!30] (0,4.5) rectangle (6,5.5); %piastra impingement
    \draw [fill=white]   (2.4,4.5) rectangle (3.6,5.5); %hole
    \draw [fill=blue!30] (2.75,-0.4) rectangle (3.15,-0.5); %lens
    \draw [fill=blue!30] (2.55,-0.5) rectangle (3.35,-1.5); %camera
    \node [text width=3cm,font=\footnotesize] at (7.6,5) {piastra\\impingement};
    \node [text width=3cm,font=\footnotesize] at (6,0.5) {acciaio};
    \node [text width=3cm,font=\footnotesize] at (6,1.4) {biadesivo};
    \node [text width=3cm,font=\footnotesize] at (6,2.05) {inconel};
    \node [text width=3cm,font=\footnotesize] at (2,2.05) {$\lambda_\mathrm{inc}$};
    \node [text width=3cm,font=\footnotesize] at (2,1.4) {$\lambda_\mathrm{biad}$};
    \node [text width=3cm,font=\footnotesize] at (2,0.5) {$\lambda_\mathrm{acc}$};
    \node [text width=3cm,font=\footnotesize] at (5,-1) {IR camera};
    \node [text width=3cm,font=\small] at (6.8,-1) {$\varepsilon_\mathrm{amb}$};
    \node [text width=3cm,font=\small] at (6.5,-0.4) {$\varepsilon_\mathrm{ext}$};
    \node [text width=3cm,font=\footnotesize] at (8.1,1.2) {piastra\\target};
    \node [text width=3cm,font=\footnotesize] at (5.4,4.2) {getto};
    \node [text width=3cm,font=\small] at (6.5,2.5) {$\varepsilon_\mathrm{int}$};
    \node [text width=3cm,font=\small] at (6.5,4.2) {$\varepsilon_\mathrm{acc}$};
    \node [text width=3cm,font=\small] at (2.6,2.6) {$\dot{q}_\mathrm{joule}$};
    \draw [-latex,ultra thick]  (1,2.3) -- +(1.1,0);
    \node[single arrow,draw=black,fill=blue,minimum height=1cm,minimum width=1cm,shape border rotate=270] at (3,4.5) {}; %freccia blu
    \draw [decorate,decoration={brace,amplitude=10pt,mirror,raise=1pt},yshift=10pt] %parentesi graffa
    (6.1,-0.3) -- (6.1,1.95) node [black,midway,xshift=0.8cm]{};
    \draw [] (0,0) -- (-0.4,0);
    \draw [] (0,1) -- (-0.4,1);
    \draw [] (0,1.8) -- (-0.4,1.8);
    \draw [] (0,2.3) -- (-0.4,2.3);
    \draw [latex-latex]  (-0.2,0) -- (-0.2,1) node [black,midway,xshift=-0.4cm]{s\ped{acc}};;
    \draw [latex-latex]  (-0.2,1) -- (-0.2,1.8) node [black,midway,xshift=-0.4cm]{s\ped{biad}};;
    \draw [latex-latex]  (-0.2,1.8) -- (-0.2,2.3) node [black,midway,xshift=-0.4cm]{s\ped{inc}};;
    \end{tikzpicture}
    \caption{Distribuzione puntuale di Nusselt per $Re=5000$}\label{fig:Nu_Re5000}
\end{figure}

\end{document}

在此处输入图片描述

在此处输入图片描述

答案1

1)绘图不居中

嗯,它居中了。问题是你的眼睛希望看到中央框居中,而不是整个边界框,其中包括侧面文本“piastra...”等。要理解这一点,请tikzpicture\fbox{....}: 包裹你的文本,你会看到该框位于页面中央。要解决此问题,你可以使用以下trim right选项:

\begin{tikzpicture}[trim right=7cm]

它将考虑坐标 (7cm,0) 之后在框外绘制的所有内容。有关修剪和边界框的更多详细信息,请参阅手册。

2)λacc 的坐标似乎不正确

为了调试这个问题,我建议尝试向有问题的节点添加一个绘制选项,以便您看到它们的形状。

\node [draw=red,text width=3cm,font=\footnotesize] at (2,2.05) {$\lambda_\mathrm{inc}$};
\node [draw=red,text width=3cm,font=\footnotesize] at (2,1.4) {$\lambda_\mathrm{biad}$};
\node [draw=red,text width=3cm,font=\footnotesize] at (2,0.5) {$\lambda_\mathrm{acc}$};

我还将在关键坐标处添加一个节点

\node[red] at (2,0.5) {x};

获取

红色方框

如您所见,节点比需要的宽得多,并且它们所处的坐标是它们的中心。现在一切都说得通了。图片的原作者通过使用 将节点的宽度人为地设置为足够宽的长度来实现这一点text width=3m。他这样做是为了让节点具有相同的宽度,否则,由于它们位于中心,因此它们不会对齐。

解决对齐问题的更好方法是移除text width并将放置的参考点设置为锚点west

\node [anchor=west,font=\footnotesize] at (.5,2.05) {$\lambda_\mathrm{inc}$};
\node [anchor=west,font=\footnotesize] at (.5,1.4) {$\lambda_\mathrm{biad}$};
\node [anchor=west,font=\footnotesize] at (.5,0.5) {$\lambda_\mathrm{acc}$};

会做需要做的事。

我鼓励您查看手册,了解positioning放置节点的选项,以及如何设置样式以获得更易于维护的代码。

相关内容