TikZ:如何将曲线视为图表中的轴?

TikZ:如何将曲线视为图表中的轴?

在所示的图像中,底部和左侧的线被视为轴...:如何将左曲线视为图表中的轴?

湿度图表:http://en.wikipedia.org/wiki/File:PsychrometricChart.SeaLevel.SI.svg

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (8,6);
%
\coordinate (ns) at (0,1.5);
\draw [thick] (ns)--++(0,-1.5)coordinate (nx)--++(7,0) coordinate (no)--++(0,6)coordinate (ny)--++(-1.5,0) coordinate (ne);
\draw [thick] (ns) to [bend right] (ne);
%
\coordinate (n1) at (5,2);
\fill[red] (n1) circle (2pt);
%axis
\path  (ny) coordinate (yaxis) |- (nx) coordinate (xaxis);
\draw[dashed] (xaxis -| n1) node[below] {$DBT_1$} -- (n1);
\draw[dashed] (yaxis |- n1) node[right] {$W_1$} -- (n1);
\end{tikzpicture}
\end{document}

在此处输入图片描述

我想要画如下图所示:一条倾斜的线到曲线上并写上 $WBT_1$

在此处输入图片描述

答案1

这不完全是您要问的(曲线不是轴),但会给出所需的结果。我相信有人会给你更好的答案,但与此同时,这里是:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (8,6);
%
\coordinate (ns) at (0,1.5);
\draw [thick] (ns)--++(0,-1.5)coordinate (nx)--++(7,0) coordinate (no)--++(0,6)coordinate (ny)--++(-1.5,0) coordinate (ne);
\draw [thick, name path=curve] (ns) to [bend right] (ne);
%
\coordinate (n1) at (5,2);
\fill[red] (n1) circle (2pt);
%axis
\path  (ny) coordinate (yaxis) |- (nx) coordinate (xaxis);
\draw[dashed] (xaxis -| n1) node[below] {$DBT_1$} -- (n1);
\draw[dashed] (yaxis |- n1) node[right] {$W_1$} -- (n1);
%
\draw[name path=line,color=white,opacity=0] (n1) -- (3,4);
\draw[dashed,name intersections={of={line and curve}}] (n1) -- (intersection-1) node[above left]{$WBT_1$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

如果您只需要在曲线上标记一些点,那么您可以decorate这样做。下一个代码是您的示例,其装饰改编自 pgf 手册中的示例。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[decoration={markings,
mark=between positions 0 and 1 step 0.1 with {
\node [circle,fill,inner sep=1pt,
name=mark-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number},
transform shape]
{};}}]
%\draw[help lines] (0,0) grid (8,6);
%
%\coordinate (ns) at (0,1.5);
\draw [thick] (0,1.5) coordinate (ns)--++(0,-1.5)coordinate (nx)--++(7,0) coordinate (no)--++(0,6)coordinate (ny)--++(-1.5,0) coordinate (ne);
\draw[thick,postaction={decorate}] (ns) to [bend right] (ne) node[circle,fill,inner sep=1pt](mark-11){};
%
%\coordinate (n1) at (5,2);
\fill[red] (5,2) coordinate (n1) circle (2pt);
%axis
%\draw path  (ny) coordinate (yaxis) |- (nx) coordinate (xaxis);
\draw[dashed] (n1) -- (nx -| n1) node[below] {$DBT_1$};
\draw[dashed] (n1) -- (ny |- n1) node[right] {$W_1$};
\draw[dashed] (n1) -- (mark-3);
\draw[dashed] (n1) -- (mark-5);
\draw[dashed] (n1) -- (mark-8);
\end{tikzpicture}
\end{document}

在此处输入图片描述

编辑

下一个代码有一点改进(我希望如此!)。我定义了一种mymark可以在同一路径上多次使用的样式。它使用两个参数,第一个参数是放置根据第二个参数命名的坐标节点的部分。这样,您可以在弯曲的轴上添加任意数量的标记(坐标)。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[%
mymark/.style 2 args={postaction={%
    decorate,
    decoration={%
    markings,
    mark=at position #1 with
    \coordinate (#2) {};}}}]

\draw [thick] (0,1.5) coordinate (ns)--++(0,-1.5)coordinate (nx)--++(7,0) coordinate (no)--++(0,6)coordinate (ny)--++(-1.5,0) coordinate (ne);

\draw[thick,mymark={0.3}{aaa},mymark={0.65}{bbb}] (ns) to [bend right] (ne);
%
\fill[red] (5,2) coordinate (n1) circle (2pt);
%axis
\draw[dashed] (n1) -- (nx -| n1) node[below] {$DBT_1$};
\draw[dashed] (n1) -- (ny |- n1) node[right] {$W_1$};
\draw[dashed] (n1) -- (aaa);
\draw[dashed] (n1) -- (bbb);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容