我想在 latex 上重新绘制以下图表。我可以制作网格,但无法正确重现图表。关于如何重现曲线,您有什么想法吗?
答案1
就像这样。 tikz 解决方案。其中(a) to[in=xx,out=xx] (b)
使用了语法。
\draw (0,0) to[out=0, in=-120] (5,2) to[out=60, in=180](10,10)--(13,10);
代码
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[]
\draw(0,0)node[below]{0} --(13,0)node[below]{t,s} ;
\draw(0,0) -- (0,10)node[left]{2.0}node[above]{s,m};
\draw[thick](0,5)node[left]{1.0}--(13,5);
\draw[thick](10,0)node[below]{20}--(10,10);
\draw[thick](5,0)node[below]{10}--(5,10);
\draw[help lines] (0,0) grid (13,10);
\draw (0,0) to[out=0, in=-120] (5,2) to[out=60, in=180](10,10)--(13,10);
\end{tikzpicture}
\end{document}
答案2
使用 PSTricks 的解决方案只是为了好玩。
\documentclass[pstricks,border=30pt,12pt,dvipsnames]{standalone}
\usepackage{pst-plot}
\usepackage[nomessages]{fp}
\FPeval\dx{round(pi*2/3:6)}
\FPeval\dy{round(pi:6)}
\def\f{x-sin(x)}
\psset
{
algebraic,
axespos=t,
labelFontSize=\scriptstyle,
xAxisLabel=${t,s}$,
yAxisLabel=${s,m}$,
xAxisLabelPos={10cm,-12pt},
yAxisLabelPos={-12pt,10cm},
}
\newpsstyle{mygrid}
{
dx=\dx,
dy=\dy,
labels=none,
ticksize=0 \psPiTwo,
subticksize=1,
subticks=5,
tickcolor=Maroon,
subtickcolor=ForestGreen,
}
\begin{document}
\begin{psgraph}[dx=\dx,dy=\dy,Dx=10,Dy=1.0](0,0)(0,0)(\psPiTwo,\psPiTwo){12cm}{!}
\psaxes[style=mygrid](0,0)(0,0)(\psPiTwo,\psPiTwo)
\psplot{0}{TwoPi}{\f}
\end{psgraph}
\end{document}
答案3
和pgfplots
:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
grid=both,
every axis x label/.style={at={(rel axis cs:0.8,0)},anchor=north west},
every axis y label/.style={at={(rel axis cs:0,1)},anchor=east},
xlabel={$t, s$},
ylabel={$s, m$},
xticklabel={\pgfmathparse{0.5*\tick*10}\pgfmathprintnumber{\pgfmathresult}},
yticklabel={\pgfmathparse{\tick/3}\pgfmathprintnumber{\pgfmathresult}},
xtick={2,4},
ytick={3,6},
extra x ticks={1,3,5,6},
extra x tick style={xticklabel=\empty,grid=major},
extra y ticks={1,2,4,5},
extra y tick style={yticklabel=\empty,grid=major},
enlargelimits=false,
clip=false,
]
\addplot[blue,thick,samples=100,domain=0:2*pi] {x-sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}