你能帮我把我的身材弄得看起来像这样吗?
梅威瑟:
\documentclass{article}
\usepackage{tikz}
\tikzset{dot/.style={fill, circle, inner sep=0pt, minimum size=4pt}}
\begin{document}
\begin{tikzpicture}[declare function={f(\x)=5/\x; df(\x)=(f(\x+.01)-f(\x-.01))/.02;}, font=\small]
\def\xone{1.8} % x-coordinate of point 1
\def\xzero{3.8} % x-coordinate of point 0
\draw (0,5)node[left]{$R_{\beta}$}--(0,0)--(5.5,0)node[below]{$R_{\alpha}$}; % axis
\draw[very thick, orange] (1,{f(1)}) node[below right]{$R_{\alpha}R_{\beta}=k$}--plot[domain=1:5] (\x,{f(\x)}); % curve
\draw[densely dashed](\xone,0)node[below]{$R_{\alpha}1$}|-(0,{f(\xone)})node[left]{$R_{\beta}1$};
\draw[densely dashed](\xzero,0)node[below]{$R_{\alpha}0$}|-(0,{f(\xzero)})node[left]{$R_{\beta}0$};
\draw([shift={(-2,{-2*df(\xzero)})}]\xzero,{f(\xzero)})--([shift={(1.5,{1.5*df(\xzero)})}]\xzero,{f(\xzero)}); % tangent line
\draw(\xone,{f(\xone)})node[dot, label={[label distance=-4pt]45:Post trade}]{}--(\xzero,{f(\xzero)})node[dot, label={[label distance=-4pt]45:Pre trade}]{};
\end{tikzpicture}
\end{document}
答案1
使用tzplot
:
\documentclass{standalone}
\usepackage{tzplot}
\begin{document}
% "A"
\begin{tikzpicture}
%\tzhelplines(6,6)
\tzaxes(6,6){x-tokens}{y-tokens}
\def\kzero{5/\x}
\def\kdelta{5/(\x-1)+1}
\def\ray{\x}
\tzfn\kzero[1:5]{$k$}[r]
%\tzfn\kdelta[2:5.5]{$k_\Delta$}[r] % hidden
\tzfn[draw=none,->,dashed]\ray[0:4] % draw=none
\tzXpoint*{kzero}{ray}(A)
\tzvXpointat*{kzero}{4}(A1)
\tzproj(A){$x$}{$y$}
\tzproj(A1){$x+\Delta(x)$}{$y+\Delta(y)$}
\end{tikzpicture}
% ------------------------------
\qquad
% "B" (copy from "A" and do something more)
\begin{tikzpicture}
%\tzhelplines(6,6)
\tzaxes(6,6){x-tokens}{y-tokens}
\def\kzero{5/\x}
\def\kdelta{5/(\x-1)+1}
\def\ray{\x}
\tzfn\kzero[1:5]{$k$}[r]
\tzfn\kdelta[2:5.5]{$k_\Delta$}[r] % shown
\tzfn[->,dashed]\ray[0:4] % draw
\tzXpoint*{kzero}{ray}(A)
%\tzvXpointat*{kzero}{4}(A1) % removed
\tzXpoint*{kdelta}{ray}(B) % added
\tzproj(A){$x$}{$y$}
\tzproj(B){$x+\Delta(x)$}{$y+\Delta(y)$}
\tztangent[red]{kdelta}(B)[2:4.5] % added
\end{tikzpicture}
\end{document}
答案2
这种方法使用scope
和\foreach
循环两次绘制两个图中所有公共元素。可以使用一些宏进一步减少代码,但起点可以是:
\documentclass[tikz,border=1mm]{standalone}
\begin{document}
\begin{tikzpicture}[scale=1.5]
% both figures
\foreach[count=\ii]\i in {A,B}
{
\begin{scope}[shift={(5*\ii-5,0)}]
\node at (-0.2,3.8) {\bfseries \i.};
\draw[latex-latex] (0,3) node[above] {$y$-tokens} |- (3,0) node[right] {\strut$x$-tokens};
\draw[blue] plot [domain=1/2.75:2.75,samples=101] (\x,1/\x) node[black,right] {$k$};
\draw[densely dotted] (0,1) node[left] {$y$} -| (1,0) node[below] {\strut$x$};
\fill (1,1) circle (0.3mm);
\end{scope}
}
% A figure
\draw[densely dotted] (0,0.5) node[left] {$y+\Delta y$} -| (2,0) node[below] {\strut$x+\Delta x$};
\fill (2,0.5) circle (0.3mm);
% B figure
\begin{scope}[shift={(5,0)}]
\draw[blue,shift={(0.75,0.75)}] plot [domain=1/2:2,samples=101] (\x,1/\x) node[black,right] {$k_\Delta$};
\draw[densely dotted] (0,1.75) node[left] {$y+\Delta y$} -| (1.75,0) node[below] {\strut$x+\Delta x$};
\draw[dashed,->] (0,0) -- (2.5,2.5);
\fill (1.75,1.75) circle (0.3mm);
\end{scope}
\end{tikzpicture}
\end{document}