如何制作覆盖图的自由体图?(圆形轴及其轴线上施加的力)

如何制作覆盖图的自由体图?(圆形轴及其轴线上施加的力)

该图描绘了所需的图表

到目前为止,我已经能够从 .csv 文件绘制其他图表:

\begin{figure}[H]
    \centering
    \resizebox{0.45\textwidth}{!}{
\begin{center}
    \begin{tikzpicture}[x=1cm,y=1cm]
      \begin{axis}[scaled ticks=false, tick label style={/pgf/number format/fixed} ,
          axis lines=middle,
          grid=major, % Display a grid
          grid style={dashed,gray!30},
          x label style={at={(axis description cs:1.13,0.55)},anchor=north},
          y label style={at={(axis description cs:0,1)},anchor=south},
          ylabel=M, 
          xlabel=L,
        ]
        \addplot [color= black] table[y=M,x=X,col sep=comma]{momento2.csv};
        \addplot [color= green,dash dot] table[y=YMAX,x=XMAX,col sep=comma]{Graficas/momento2.csv};
      \end{axis}
    \end{tikzpicture}
  \end{center}}
    \caption{Momento vs Distancia}
    \label{momentovsdistancia}
\end{figure}

代码生成此图:从 .csv 文件生成的图表

答案1

我猜你正在寻找类似的东西,但我不确定。另外,我们没有你的数据文件 (momento2.csv),所以我画的是近似函数。

你可以用 Ti 来绘画在 axis 环境中使用 Z,但您需要在此环境中引用坐标。为此,您需要使用axis cs:如下选项

\draw[blue] (axis cs: \L,0) ellipse (0.025 and 0.08);

也更好地代替使用\pgfplotsinkoveforeach\foreach但其余的是普通的 TiZ。

\documentclass[border=2mm]{standalone}
\usepackage    {pgfplots}
\usepackage    {siunitx}  % SI units
\pgfplotsset   {compat=1.17}
\usetikzlibrary{babel}    % sometimes tikz and babel don't get along
                          % (a veces hay conflictos con tikz y spanish babel,
                          %  en particular con las flechas ->)

\begin{document}
\begin{tikzpicture}
\begin{axis}[scaled ticks=false, tick label style={/pgf/number format/fixed},
    axis lines=middle,
    grid=major, % Display a grid
    grid style={dashed,gray!30},
    x label style={at={(axis description cs:1.13,0.55)},anchor=north},
    y label style={at={(axis description cs:0,1)},anchor=south},
    ylabel=M, 
    xlabel=L,
    clip=false, % <-- we want to draw 'outside' the axes
    ]
  % I don't have the data so I'm drawing approximate functions
  \def\L{0.27504}
  \def\Y{0.43}
  \pgfmathsetmacro\a{-4*\Y/(\L*\L)}
  \pgfmathsetmacro\b{-\a*\L}
  \addplot [domain=0:\L] {\a*x^2+\b*x)};                        % momento2.csv
  \addplot [color=green,dash dot] coordinates {(0,\Y) (\L,\Y)}; % Graficas/momento2.csv
  % free body diagram
  \draw[blue,dashed] (axis cs: 0,0.08) arc (90:-90:0.025 and 0.08);
  \draw[blue] (axis cs: \L,0.08) --++ (-\L,0) arc (90:270:0.025 and 0.08) --++ (\L,0);
  \draw[blue] (axis cs: \L,0) ellipse (0.025 and 0.08);
  \draw[thick,green,-latex] (axis cs: 0 ,0.08) --++ (0,0.2) node [black,right] {$R_a$};
  \draw[thick,green,-latex] (axis cs: \L,0.08) --++ (0,0.2) node [black,right] {$R_b$};
  \draw[blue,<->] (axis cs: 0, 0.15) --++ (\L,0);
  \draw[orange]   (axis cs: 0,-0.13) --++ (\L,0);
  \pgfplotsinvokeforeach{0,...,10}
  {%
    \draw[orange,-latex] (#1*\L/10,-0.08) --++ (0,-0.05);
  }
  \node[draw] at (0.5*\L,-0.16) {\SI{46.9670}{N/m}};
  \node[draw] at (0.5*\L, 0.18) {\SI{0.27504}{m}};
  \node       at (0.5*\L, 0.22) {$L$};
  \end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容