CSV 데이터의 3D 표면 플롯

CSV 데이터의 3D 표면 플롯

채널을 통해 측정된 프로브의 속도 데이터를 플롯하려고 합니다.

목표는 측정된 지점에 걸쳐 있고 속도 값(v)에 따라 색상이 지정되어 있으며 위에서 본 표면입니다(예: "컬러맵"?). 해당 지점 사이의 음영을 포함합니다. 하루 동안 노력한 끝에 내가 생각해 낼 수 있었던 가장 좋은 결과는 다음과 같습니다. 점 사이의 음영이 여전히 누락되었습니다.

매개변수를 교체하면 상황 addplot3surf더욱 악화됩니다.

\documentclass{article}
\usepackage{pgfplots, filecontents}


\begin{filecontents*}{04_v_plot.csv}
depth,column,v
0.05,0.025,3.797153190429337
0.1,0.025,3.726861900740809
0.15,0.025,3.5359111045962095
0.2,0.025,3.4128410835129053
0.25,0.025,3.140235925631795
0.05,0.1,4.243357377017983
0.1,0.1,4.1459069835908196
0.15,0.1,3.9166226281025893
0.2,0.1,4.106142900384007
0.25,0.1,3.4708819672783275
0.05,0.175,4.132121899523459
0.1,0.175,3.768785853709482
0.15,0.175,3.345251163711442
0.2,0.175,3.2543256435843415
0.25,0.175,2.7823975289356344
\end{filecontents*}

\begin{document}

\begin{figure}
  \centering
  \begin{tikzpicture}
    \begin{axis}[
      xlabel={Horizontal position},
      ylabel={Depth},
      colorbar,
      y dir=reverse,
      ymin=0,
      ymax=0.3,
      xmin=0,
      xmax=0.2,
      view={0}{90},
      ]

      \addplot3+[scatter, only marks] table[x=column,y=depth,z=v,col sep=comma]{04_v_plot.csv};
    \end{axis}
  \end{tikzpicture}
  \caption{Velocities at positions}%
\end{figure}

\end{document}

원본 CSV의 데이터를 재정렬했습니다.

depth,A,B,C
0.05,3.797153190429337,4.243357377017983,4.132121899523459
0.1,3.726861900740809,4.1459069835908196,3.768785853709482
0.15,3.5359111045962095,3.9166226281025893,3.345251163711442
0.2,3.4128410835129053,4.106142900384007,3.2543256435843415
0.25,3.140235925631795,3.4708819672783275,2.7823975289356344

원본 csv 파일을 읽고 데이터를 그릴 수 있습니까?

답변1

Asymptote해결책:

// csv-colormap.asy
//
// run  
//    asy csv-colormap.asy
//
// to get a standalone image in csv-colormap.pdf
//
settings.tex="pdflatex";
size(12cm,12cm);
import graph;
import palette;
import colorbrewer;
import fontsize;defaultpen(fontsize(8pt));
texpreamble("\usepackage{lmodern}"+"\usepackage{amsmath}"
            +"\usepackage{amsfonts}"+"\usepackage{amssymb}");
file fin=input("04_v_plot.csv").csv();
string[] s=fin.line(); // skip the title line
real[][] A=fin;
A=transpose(A);
real[] x=A[0];
real[] y=A[1];
real[] z=A[2];

pen[] Palette=Blues9;

picture bar;
bounds range=image(x,y,z,Palette);

palette(bar,rotate(90)*"Velocity",range,(0,0),(0.5cm,5.3cm)
          ,Right,Palette,PaletteTicks("$%+#.1f$"));
add(bar.fit(),point(E),30E);

xaxis("Horizontal position",BottomTop,LeftTicks(Step=0.05,step=0.01),above=true);
yaxis("Depth",LeftRight,RightTicks(Step=0.05,step=0.01),above=true);

여기에 이미지 설명을 입력하세요

이 코드는 팔레트를 사용한다는 점에 유의하세요.Blues9이 코드는 다음의 colorbrewer.asy, 이는 신시아 브루어(Cynthia Brewer) 교수의 색 구성표 점근선을 위한 펜 배열로. 물론 다른 적절한 팔레트로 교체할 수도 있습니다.

관련 정보