
답변1
나는 이것을 사용했습니다 :https://mathematica.stackexchange.com/questions/19859/plot-extract-data-to-a-file처음에는. 플롯의 첫 번째 요소 dynamicalStream
는 빈 문자열과 객체였습니다.GraphicsComplex
. 나는 플롯에서 점을 추출했습니다 points = dynamicalStream[[1]][[2]][[1]]
. 다른 사람에게는 다를 수도 있습니다. Line
이 개체의 개체는 다음 GraphicsComplex
을 사용하여 추출되었습니다. (이 작업을 수행한 방식에 대해 사과드립니다. 아마도 더 나은 방법이 있을 것입니다.)
lines = dynamicalStream[[1]][[2]][[2]][[2]][[3]][[2 ;; Length[ dynamicalStream[[1]][[2]][[2]][[2]][[3]]]] ].
나는 이것이 유용하지 않을 것이라고 말하고 싶습니다. 따라서 더 일반적인 방법을 찾거나 목록에서 추출할 올바른 부분을 수동으로 찾는 방법을 사용하십시오.
그런 다음 각 요소 자체가 각 선의 점 목록인 목록을 만들었습니다. 이것은 pointstable = Table[points[[#[[1]][[i]]]], {i, 1, Length[#[[1]]]}] & /@ lines
. 내부 목록은 Line
개체의 각 요소(목록에 있는 점의 위치 ) 를 살펴 points
보고 올바른 점을 추출하여 생성되었습니다. 따라서 에 해당하는 포인트 목록을 만듭니다 Line
. 그런 다음 각 Line
개체 에 매핑되므로 lines
최종 목록은 설명된 형식이 됩니다.
Export["line" <> IntegerString[#2] <> ".txt", #,"Table"] &~MapIndexed~pointstable
그런 다음 링크에 설명된 대로 각 목록을 별도의 텍스트 파일에 저장했습니다 .
나는 다음과 같이 계획했습니다.
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{decorations.markings}
\tikzset{->-/.style={decoration={
markings,
mark=at position #1 with {\arrow{>}}},postaction={decorate}}}
\tikzset{-<-/.style={decoration={
markings,
mark=at position #1 with {\arrow{<}}},postaction={decorate}}}
\begin{document}
\begin{tikzpicture}[scale=1.5]
\begin{axis}[axis lines=none]
\foreach \i in {1,2,3,4,...,107}{
\addplot[black,->-=0.5] table[]{line\i.txt};
}
\end{axis}
\end{tikzpicture}
\end{document}
해당 링크를 제대로 살펴본 후 더 쉬운 방법은 다음과 같습니다.
points = Cases[dynamicalStream, GraphicsComplex[data__] :> data, -3, 1][[1]]
lines = Cases[dynamicalStream, Line[data__] :> data, -3];
pointstable = Table[points[[#[[i]]]], {i, 1, Length[#]}] & /@ lines