是否可以在epslatex終端的gnuplot標籤中使用自定義變量和字符串? 我想要一個標籤:「t85 = 15.6」,其中「t85 =」是字符串,「15.6」是我在gnuplot腳本中設置的變量。如何在epslatex終端的gnuplot標籤中使用字符串和變量?
set terminal epslatex
set output 'TP_MAG_5s_Decklage1.tex'
set xlabel "time/s"
set xrange [0:250]
set ylabel "T/C"
set yrange [0:1800]
TP_MAG_5s_Decklage1.dat"
t85_1 = system("awk '$1<800 && $1>500 { count++ } END { print count/100 }' TP_MAG_5s_Decklage1.dat")
t85_2 = system("awk '$2<800 && $2>500 { count++ } END { print count/100 }' TP_MAG_5s_Decklage1.dat")
set label 1 at 150,700 t85_1
set label 2 at 150,600 t85_2
plot 'TP_MAG_5s_Decklage1.dat' using ($0/100):1 w l title 'TC 1',\
'TP_MAG_5s_Decklage1.dat' using ($0/100):2 w l title 'TC 2',\
800 notitle , 500 notitle
此代碼僅給出變量的值作爲標籤。我無法爲此標籤添加一些文字。
這個錯誤通常發生在缺少關閉'$'時,或者某些文本應該處於數學模式'$ text $'而且不是。 –
謝謝,我發現缺少$符號,但我想在標籤中使用Latex命令(我更改了示例代碼以顯示標記) – cps
您需要使用gprintf來顯示變量名稱,並且您可以在引號,所以它會被LaTeX解釋。 –