pgfplots / gnuplot:3D2パラメトリック関数を描画する方法
Aug 22 2020
2パラメトリック曲面関数をプロットしたい
set parametric
splot cos(u)*cos(v),sin(u)*cos(v),sin(v)
(ヒント:gnuplotに入れるだけで動作します。)
このような特別な機能には、pgfplotsの特別な設定が必要だと思います。
だから:なぜ2番目の例は何もプロットしないのですか?
ここでpgfplotsに設定する必要があるオプションはどれですか?
% arara: pdflatex: {shell: yes}
\documentclass[margin=3mm, tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest, width=7cm}
\begin{document}
\begin{tikzpicture}
\begin{axis}[title=Works]
\addplot3[]
gnuplot{sin(x)*sin(y)};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[font=\footnotesize,]
\begin{axis}[title={Works not - what do I have to set?}]
\addplot3[]
gnuplot {
set parametric
splot cos(u)*cos(v),sin(u)*cos(v),sin(v)
};
\end{axis}
\end{tikzpicture}
\end{document}
\end{document}

sthを与える必要があります。このような:

回答
2 TorbjørnT. Aug 23 2020 at 17:07
.gnuplot
どのコードがGnuplotに渡されているかを確認できるファイルを取得します。
あなたの場合あなたは得る
set table "test.pgf-plot.table"; set format "%.5f"
set format "%.7e";; set samples 25, 25; set dummy x,y; set isosamples 25, 25; splot [x=-5:5] [y=-5:5] set parametric splot cos(u)*cos(v),sin(u)*cos(v),sin(v) ;
あなたが見ることができるようにあなたは得るsplot <domain settings> <your code>
、つまりGnuplotは得る
splot ... set parametric
aftersplot
とoptionsには関数式が必要なため、これは機能しません。また、.log
ファイル内のGnuplotからのエラーを見ることができます、それは言います
"test.pgf-plot.gnuplot" line 2: undefined variable: set
どこにset
問題となっているが、その中にありますset parametric
。
これを修正するparametric
には、set parametric
次の代わりにTikZ側のキーを使用できます。
% arara: pdflatex: {shell: yes}
\documentclass[margin=3mm, tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest, width=7cm}
\begin{document}
\begin{tikzpicture}[font=\footnotesize,]
\begin{axis}[title={Works not - what do I have to set?}]
\addplot3[]
gnuplot [parametric=true] {
cos(u)*cos(v),sin(u)*cos(v),sin(v)
};
\end{axis}
\end{tikzpicture}
\end{document}
または、を使用できますraw gnuplot
。その場合、pgfplots
渡されるのではなく、Gnuplotコードでドメインとサンプルサイズを設定する必要があります。
% arara: pdflatex: {shell: yes}
\documentclass[margin=3mm, tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest, width=7cm}
\begin{document}
\begin{tikzpicture}[font=\footnotesize,]
\begin{axis}[title={Works not - what do I have to set?}]
\addplot3[]
gnuplot [raw gnuplot] {
set parametric;
splot cos(u)*cos(v),sin(u)*cos(v),sin(v)
};
\end{axis}
\end{tikzpicture}
\end{document}