首页 > 解决方案 > 如何在 Gnuplot 上以 f(x,y)=0 的形式绘制特定解

问题描述

我需要在 Gnuplot 上绘制一个与 0 相交的两个变量函数,即:f(x,y)=0。这将意味着 2D 绘图而不是 3D。到目前为止,我的尝试是:

set term cairolatex eps standalone size 6in,6in lw 7
set key box opaque samplen 6
set key spacing 1.5
set key Right
set key height 2
set key width 3
f(x,y)=...
set output 'V.tex'
plot f(x,y)=0 title '\small${\hat{V}=2}$' lc rgb "black"
set out

但它返回函数以绘制预期

以防万一,Gnuplot FAQ 的 5.2 部分中给出的解决方法http://www.gnuplot.info/faq/faq.html不会生成我可以编译的 .tex 文件。

标签: gnuplotimplicit

解决方案


我尝试将常见问题解答(@gdupras 的答案)中的代码与您最初显示的代码结合起来。

set term cairolatex eps standalone size 6in,6in lw 7
set key box opaque samplen 6
set key spacing 1.5
set key Right
set key height 2
set key width 3

f(x,y) = y - x**2 / tan(y)  
set contour base  
set cntrparam levels discrete 0.0  
unset surface  
set table $TEMP  
splot f(x,y)  
unset table  

set output 'V.tex'
plot $TEMP w l title '\small${\hat{V}=2}$' lc rgb "black"
set out

在我的环境中,此代码生成“V.tex”,编译后得到下图(PDF 转换为 PNG)。

在此处输入图像描述


推荐阅读