13개 열이 있는 테이블에서 많은 시뮬레이션 데이터를 얻고 있습니다. 여기에서 다음을 플롯하고 싶습니다. x축은 열 번호 12(E)여야 하며 이는 괜찮습니다 plotNoX=12
. y축은 열 번호 10(팝)을 열 번호 13(축퇴)으로 나눈 값이어야 합니다.
문제는 포스트스크립트에서 해결될 수 있을 것 같지만 내부 데이터에 액세스하는 방법을 모르겠습니다.
원본 데이터 및 척도 그래프가 포함된 MWE:
!TeX program = xelatex
\documentclass{scrartcl}
\usepackage{filecontents}
\begin{filecontents}{Boltzmann-Plot.txt}
, E_J, J, component, E_v, v, N, id, numlines, pops, errors, specie, E, degeneracy
0, 204.32, 3.5, 1, 32314.13, 0, 3, 155, 6, 2.0503590454, 0.0549585571, 32518.45, 8
1, 339.81, 4.5, 1, 32314.13, 0, 4, 157, 6, 1.9458976329, 0.0468620867, 32653.94, 10
2, 102.37, 2.5, 1, 32314.13, 0, 2, 153, 6, 1.909089931, 0.0630666458, 32416.5, 6
3, 508.54, 5.5, 1, 32314.13, 0, 5, 159, 6, 1.6624777745, 0.047496399, 32822.67, 12
4, 203.53, 2.5, 2, 32314.13, 0, 3, 154, 6, 1.4258811354, 0.0373668708, 32517.66, 6
5, 507.3, 4.5, 2, 32314.13, 1, 5, 158, 6, 1.3639953283, 0.0228045864, 32821.43, 10
6, 710.18, 6.5, 1, 32314.13, 1, 6, 161, 6, 1.303716013, 0.0202061018, 33024.31, 14
7, 34.19, 1.5, 1, 32314.13, 1, 1, 151, 5, 1.2909918307, 0.0810218945, 32348.32, 4
8, 338.79, 3.5, 2, 32314.13, 1, 4, 156, 6, 1.2815394104, 0.0191664948, 32652.92, 8
9, 944.35, 7.5, 1, 32314.13, 2, 7, 163, 6, 1.2091683402, 0.0533139809, 33258.48, 16
10, 08.71, 5.5, 2, 32314.13, 2, 6, 160, 6, 1.1679741692, 0.0403405467, 33022.84, 12
11, 942.65, 6.5, 2, 32314.13, 2, 7, 162, 6, 0.9963321806, 0.023514499, 33256.78, 14
12, 101.8, 1.5, 2, 32314.13, 2, 2, 152, 5, 0.9200611356, 0.0756242618, 32415.93, 4
13, 1210.61, 8.5, 1, 32314.13, 2, 8, 165, 6, 0.911434806, 0.0380645658, 33524.74, 18
\end{filecontents}
\usepackage[]{pst-plot}
\pagestyle{empty}
\readdata[ignoreLines=5]{\Boltzmann}{Boltzmann-Plot.txt}
\begin{document}
\begin{pspicture}
\begin{psgraph}[
Ox=3.3,dx=0.1,Dx=0.1,xlabelFactor={ \cdot 10^4},
Oy=-1,ylogBase=10,
comma]{->}(3.2,-1)(3.5,1.1){12cm}{9cm}
\pstScalePoints(1e-4,1){}{log}
\listplot[plotNoMax=12,plotNo=9,plotNoX=12,yMinValue=0.00001,plotstyle=dots]{\Boltzmann}
\end{psgraph}
\end{pspicture}
\end{document}
편집: 측면을 제거했습니다.
edit2: 물리적 정확성을 위해 팝은 곱셈이 아닌 퇴화로 나누어야 합니다.
답변1
최신 버전에서는 에 대한 선택적 인수를 pst-plot
사용할 수도 있습니다 .ignoreLines
\psreadDataColumn
녹색은 y10*y12입니다:
\documentclass{scrartcl}
\usepackage{filecontents}
\begin{filecontents*}{Boltzmann-Plot.txt}
, E_J, J, component, E_v, v, N, id, numlines, pops, errors, specie, E, degeneracy
0, 204.32, 3.5, 1, 32314.13, 0, 3, 155, 6, 2.0503590454, 0.0549585571, 32518.45, 8
1, 339.81, 4.5, 1, 32314.13, 0, 4, 157, 6, 1.9458976329, 0.0468620867, 32653.94, 10
2, 102.37, 2.5, 1, 32314.13, 0, 2, 153, 6, 1.909089931, 0.0630666458, 32416.5, 6
3, 508.54, 5.5, 1, 32314.13, 0, 5, 159, 6, 1.6624777745, 0.047496399, 32822.67, 12
4, 203.53, 2.5, 2, 32314.13, 0, 3, 154, 6, 1.4258811354, 0.0373668708, 32517.66, 6
5, 507.3, 4.5, 2, 32314.13, 1, 5, 158, 6, 1.3639953283, 0.0228045864, 32821.43, 10
6, 710.18, 6.5, 1, 32314.13, 1, 6, 161, 6, 1.303716013, 0.0202061018, 33024.31, 14
7, 34.19, 1.5, 1, 32314.13, 1, 1, 151, 5, 1.2909918307, 0.0810218945, 32348.32, 4
8, 338.79, 3.5, 2, 32314.13, 1, 4, 156, 6, 1.2815394104, 0.0191664948, 32652.92, 8
9, 944.35, 7.5, 1, 32314.13, 2, 7, 163, 6, 1.2091683402, 0.0533139809, 33258.48, 16
10, 08.71, 5.5, 2, 32314.13, 2, 6, 160, 6, 1.1679741692, 0.0403405467, 33022.84, 12
11, 942.65, 6.5, 2, 32314.13, 2, 7, 162, 6, 0.9963321806, 0.023514499, 33256.78, 14
12, 101.8, 1.5, 2, 32314.13, 2, 2, 152, 5, 0.9200611356, 0.0756242618, 32415.93, 4
13, 1210.61, 8.5, 1, 32314.13, 2, 8, 165, 6, 0.911434806, 0.0380645658, 33524.74, 18
\end{filecontents*}
\usepackage{pst-plot}
\pagestyle{empty}
\readdata[ignoreLines=5]{\Boltzmann}{Boltzmann-Plot.txt}
\psreadDataColumn[ignoreLines=1]{12}{,}{\xData}{Boltzmann-Plot.txt}
\psreadDataColumn[ignoreLines=1]{10}{,}{\yDataOne}{Boltzmann-Plot.txt}
\psreadDataColumn[ignoreLines=1]{13}{,}{\yDataTwo}{Boltzmann-Plot.txt}
\def\DATA{
/X [\xData] def
/Y1 [\yDataOne] def
/Y2 [\yDataTwo] def % save as array
0 1 X length 1 sub { % on stack is the loop variable
/Index ED % save it
X Index get
Y1 Index get Y2 Index get mul % y10*y13
} for
}
\begin{document}
\begin{pspicture}
\begin{psgraph}[
Ox=3.3,dx=0.1,Dx=0.1,xlabelFactor={ \cdot 10^4},
Oy=-1,ylogBase=10,comma]{->}(3.2,-1)(3.5,1.5){12cm}{9cm}
\pstScalePoints(1e-4,1){}{log}
\psset{plotstyle=dots,dotscale=1.5}
\listplot[linecolor=green]{\DATA}
\listplot[plotNoMax=12,plotNo=9,plotNoX=12,linecolor=red]{\Boltzmann}
\listplot[plotNoMax=12,plotNo=12,plotNoX=12,linecolor=blue]{\Boltzmann}
\end{psgraph}
\end{pspicture}
\end{document}
v 열에 따라 점을 색칠하는 방법은 다음과 같습니다.
\documentclass{minimal}
\usepackage{pst-plot}
\pagestyle{empty}
\readdata[ignoreLines=5]{\Boltzmann}{Boltzmann-Plot.txt}
\psreadDataColumn[ignoreLines=1]{12}{,}{\xData}{Boltzmann-Plot.txt}
\psreadDataColumn[ignoreLines=1]{10}{,}{\yDataOne}{Boltzmann-Plot.txt}
\psreadDataColumn[ignoreLines=1]{13}{,}{\yDataTwo}{Boltzmann-Plot.txt}
\psreadDataColumn[ignoreLines=1]{6}{,}{\ColValue}{Boltzmann-Plot.txt}
\makeatletter
\def\specialPlot{%
\begin@SpecialObj
\addto@pscode{
/X [\xData] def
/Y1 [\yDataOne] def
/Y2 [\yDataTwo] def % save as array
/Color [\ColValue] def
0 1 X length 1 sub { % on stack is the loop variable
/Index exch def % save it
X Index get 1.e-4 mul
Y1 Index get Y2 Index get mul log % log(y10*y13)
\tx@ScreenCoor
gsave
3 0 360 arc
Color Index get /No exch def
No 0 eq { 1 0 0 setrgbcolor } if
No 1 eq { 0 1 0 setrgbcolor } if
No 2 eq { 0 0 1 setrgbcolor } if
fill
stroke
grestore
} for
}
\use@pscode
\end@SpecialObj
}
\makeatother
\begin{document}
\begin{pspicture}
\begin{psgraph}[
Ox=3.3,dx=0.1,Dx=0.1,xlabelFactor={ \cdot 10^4},
Oy=-1,ylogBase=10,comma]{->}(3.2,-1)(3.5,1.5){12cm}{9cm}
\psset{plotstyle=dots,dotscale=1.5}
\specialPlot
\end{psgraph}
\end{pspicture}
\end{document}
fill
점 대신 원에 대한 설명
답변2
이것이 답변인지 잘 모르겠습니다. 적어도 존재하지 않는 명령에 대한 앵커이자 대신 \psreadColumnData
사용해야 하는 정보 입니다 \psreadDataColumn
. 이 명령은 잘 작동합니다.
업데이트: 수정본을 수용: div
대신 mul
.
\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{math}
\usepackage{filecontents}
%, E_J, J, component, E_v, v, N, id, numlines, pops, errors, specie, E, degeneracy
\begin{filecontents}{Boltzmann-Plot.txt}
0, 204.32, 3.5, 1, 32314.13, 0, 3, 155, 6, 2.0503590454, 0.0549585571, 32518.45, 8
1, 339.81, 4.5, 1, 32314.13, 0, 4, 157, 6, 1.9458976329, 0.0468620867, 32653.94, 10
2, 102.37, 2.5, 1, 32314.13, 0, 2, 153, 6, 1.909089931, 0.0630666458, 32416.5, 6
3, 508.54, 5.5, 1, 32314.13, 0, 5, 159, 6, 1.6624777745, 0.047496399, 32822.67, 12
4, 203.53, 2.5, 2, 32314.13, 0, 3, 154, 6, 1.4258811354, 0.0373668708, 32517.66, 6
5, 507.3, 4.5, 2, 32314.13, 1, 5, 158, 6, 1.3639953283, 0.0228045864, 32821.43, 10
6, 710.18, 6.5, 1, 32314.13, 1, 6, 161, 6, 1.303716013, 0.0202061018, 33024.31, 14
7, 34.19, 1.5, 1, 32314.13, 1, 1, 151, 5, 1.2909918307, 0.0810218945, 32348.32, 4
8, 338.79, 3.5, 2, 32314.13, 1, 4, 156, 6, 1.2815394104, 0.0191664948, 32652.92, 8
9, 944.35, 7.5, 1, 32314.13, 2, 7, 163, 6, 1.2091683402, 0.0533139809, 33258.48, 16
10, 08.71, 5.5, 2, 32314.13, 2, 6, 160, 6, 1.1679741692, 0.0403405467, 33022.84, 12
11, 942.65, 6.5, 2, 32314.13, 2, 7, 162, 6, 0.9963321806, 0.023514499, 33256.78, 14
12, 101.8, 1.5, 2, 32314.13, 2, 2, 152, 5, 0.9200611356, 0.0756242618, 32415.93, 4
13, 1210.61, 8.5, 1, 32314.13, 2, 8, 165, 6, 0.911434806, 0.0380645658, 33524.74, 18
\end{filecontents}
\usepackage[]{pst-plot}
\pagestyle{empty}
\readdata[ignoreLines=5]{\Boltzmann}{Boltzmann-Plot.txt}
\psreadDataColumn{12}{,}{\xData}{Boltzmann-Plot.txt}
\psreadDataColumn{10}{,}{\yDataOne}{Boltzmann-Plot.txt}
\psreadDataColumn{13}{,}{\yDataTwo}{Boltzmann-Plot.txt}
\def\DATA{ % tried to adapt from https://tex.stackexchange.com/a/141094/121799
/X [\xData] def /Y [\yDataOne] def /Z [\yDataTwo] def %save as array
0 1 X length 1 sub { % on stack is the loop variable
/Index ED % save it
X Index get Y Index get Z Index get mul % get x and y as y/z
} for }
\typeout{\xData}
\typeout{\yDataOne}
\typeout{\yDataTwo}
\begin{document}
\begin{pspicture}
\begin{psgraph}[
Ox=3.3,dx=0.1,Dx=0.1,xlabelFactor={ \cdot 10^4},
Oy=-1,ylogBase=10,
comma]{->}(3.2,-2)(3.5,1.1){12cm}{9cm}
\pstScalePoints(1e-4,1){}{log}
\listplot[plotstyle=dots]{\DATA}
%\listplot[plotNoMax=12,plotNo=9,plotNoX=12,yMinValue=0.00001,plotstyle=dots]{\Boltzmann}
\end{psgraph}
\end{pspicture}
\end{document}