我已经绘制了一个函数现在我想删除两个坐标并将 ylabel 与其值分组然后将原点置于 O(0,0)

我已经绘制了一个函数现在我想删除两个坐标并将 ylabel 与其值分组然后将原点置于 O(0,0)
\documentclass[12pt,a4paper,french]{article}

\usepackage[T1]{fontenc}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{arrows.meta, arrows}
\pagestyle{empty}

\begin{document}

\definecolor{sexdts}{rgb}{0.1803921568627451,0.49019607843137253,0.19607843137254902}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm, scale=.78]
\begin{axis}[
x=20cm,y=100cm,
xlabel = {t(s)} ,
ylabel = {x(m)},
title = ,
axis lines=center,
ymajorgrids=true,
xmajorgrids=true,
xmin=0,
xmax=0.9,
ymin=-0.06307777777777772,
ymax= 0.06307777777777772,
xtick={0,0.1,...,1.7},
ytick={-0.06,-0.049999999999999996,...,0.049999999999999996},]
\clip(-0.1475960421205511,-0.06307777777777772) rectangle (1.7742928467683272,0.053744444444444484);
\draw[line width=3pt,color=sexdts,smooth,samples=100,domain=0:1] plot(\x,{0.04*sin((5*3.141592653589793*(\x)+(7*3.141592653589793)/6)*180/pi)});
\begin{scriptsize}
\draw[color=sexdts] (-0.13346450617283875,0.039355555555555595) node {$f$};
\end{scriptsize}
% \node[below left ] at (0,0) {O};
\end{axis}
\end{tikzpicture}

\end{document}

功能

答案1

让我猜猜:你用了什么软件来制作这个图?如果你添加

ytick scale label code/.code={},
/pgf/number format/precision=1,
/pgf/number format/fixed

对于轴的选项,你会得到

\documentclass[12pt,a4paper,french]{article}

\usepackage[T1]{fontenc}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{arrows.meta, arrows}
\pagestyle{empty}

\begin{document}

\definecolor{sexdts}{rgb}{0.1803921568627451,0.49019607843137253,0.19607843137254902}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm, scale=.78]
\begin{axis}[
x=20cm,y=100cm,
xlabel = {$t$(s)} ,
ylabel = {$x$(m)},
title = ,
axis lines=center,
ymajorgrids=true,
xmajorgrids=true,
xmin=0,
xmax=0.9,
ymin=-0.06307777777777772,
ymax= 0.06307777777777772,
xtick={0,0.1,...,1.7},
ytick={-0.06,-0.049999999999999996,...,0.049999999999999996},
ytick scale label code/.code={},
/pgf/number format/precision=1,
/pgf/number format/fixed]
\clip(-0.1475960421205511,-0.06307777777777772) rectangle (1.7742928467683272,0.053744444444444484);
\draw[line width=3pt,color=sexdts,smooth,samples=100,domain=0:1] plot(\x,{0.04*sin((5*3.141592653589793*(\x)+(7*3.141592653589793)/6)*180/pi)});
\begin{scriptsize}
\draw[color=sexdts] (-0.13346450617283875,0.039355555555555595) node {$f$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

然而,这在很多方面仍然令人遗憾。最好不要使用pgfplots外部程序来绘制此函数。

\documentclass[12pt,a4paper,french]{article}
\usepackage[T1]{fontenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usetikzlibrary{arrows}
\pagestyle{empty}

\begin{document}

\definecolor{sexdts}{rgb}{0.1803921568627451,0.49019607843137253,0.19607843137254902}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45]
\begin{axis}[width=.95\textwidth,
xlabel = {$t$(s)} ,
ylabel = {$x$(m)},
title = ,
axis lines=center,
ymajorgrids=true,
xmajorgrids=true,
xmin=0,
xmax=0.9,
ymin=-0.063,
ymax= 0.063,
xtick={0,0.1,...,1.7},
ytick={-0.06,-0.05,...,0.05},
/pgf/number format/precision=3,
/pgf/number format/fixed,scaled y ticks=false]
\addplot[line width=3pt,color=sexdts,smooth,samples=100,domain=0:1] 
{0.04*sin((5*pi*x+(7*pi)/6)*180/pi)} node[pos=0.9,above]{$f$};
\end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容