如何将 tikzpicture 与小页面水平对齐?

如何将 tikzpicture 与小页面水平对齐?
\documentclass[12pt]{scrartcl}
\usepackage{pgfplots}
\usepackage{tikz}  
\usepackage{blindtext}

\begin{document}


\begin{minipage}[t]{0.6\linewidth}
  \blindtext[0]
\end{minipage}\hfill
\begin{tikzpicture}[scale=0.4,baseline=1.5cm]
  \begin{axis} [
      view={0}{30},
      axis lines=none,]
      \addplot3 [ultra thick, blue, domain=3:7*pi, samples = 100, samples y=0] ({sin(deg(-x))}, {cos(deg(-x))}, {x});
  \end{axis}
\end{tikzpicture}

\end{document}

在此处输入图片描述

如您所见,tikzpicture 没有在左侧“0.4\linewidth-segment”水平居中(我称之为 0.4\linewidth,因为 minipage 的宽度 = 0.6\linewidth)。

我使用基线来调整 tikzpictures 的垂直位置,每次都手动选择合适的基线值。但如何水平移动它?如何才能将 tikzpicture 绘制在与文本和纸张边缘相同的距离处?

答案1

在此处输入图片描述

\documentclass[12pt]{scrartcl}
\usepackage{pgfplots}
\usepackage{tikz}  
\usepackage{blindtext}

\begin{document}

\noindent
\hbox to \linewidth{%
\begin{minipage}[c]{0.5\linewidth}
  \blindtext[0]
\end{minipage}\hspace{1in}
\begin{minipage}[c]{0.3\linewidth}
\begin{tikzpicture}[scale=0.4,]
    \begin{axis} [
        view={0}{30},
        axis lines=none,]
        \addplot3 [ultra thick, blue, domain=3:7*pi, samples = 100, samples y=0] ({sin(deg(-x))}, {cos(deg(-x))}, {x});
    \end{axis}
\end{tikzpicture}
\end{minipage}
}\par
\end{document}

答案2

在此处输入图片描述

红线表示文本宽度/边距。

\documentclass[12pt]{scrartcl}
\usepackage{pgfplots}
\usepackage{tikz}  
\usepackage{blindtext}
\usepackage{showframe}\renewcommand*\ShowFrameColor{\color{red}}

\newlength{\mylength}       
\settoheight{\mylength}{S}
\begin{document}

\noindent
\begin{minipage}[t]{0.6\linewidth}
  \blindtext[0]
\end{minipage}%
\begin{minipage}[t]{0.4\textwidth}
\centering
\begin{tikzpicture}[scale=0.4, baseline={([yshift=-\mylength]current bounding box.north)}]
  \begin{axis} [
      view={0}{30},
      axis lines=none,]
      \addplot3 [ultra thick, blue, domain=3:7*pi, samples = 100, samples y=0] ({sin(deg(-x))}, {cos(deg(-x))}, {x});
  \end{axis}
\end{tikzpicture}
\end{minipage}
\end{document}

相关内容