我试图将反函数的图形绘制为y = xe ^ x,其中y = -1上方的图是实线,下面是虚线。我想分别标出实线和虚线,但它们相互重叠。我怎么能绕过这个?
这是我的代码:
set multiplot
set parametric
set style arrow 1 head filled size char 1.5,20,50
set arrow 1 from -4.1,0 to 4.1,0 heads
set arrow 2 from 0,-4.1 to 0,4.1 heads
set trange[-4:4]
set xrange[-4:4]
set yrange[-4:4]
set xlabel "x"
set ylabel "y"
unset border
set xtics axis format " "
set ytics axis format " "
set arrow from -exp(-1),-1 to -exp(-1),0 nohead lt 3
set arrow from -exp(-1),-1 to 0,-1 nohead lt 3
set label "$e^{-1}" at -exp(-1),0.2
set label "-1" at 0.1,-1
plot [-1:4] t*exp(t),t title '$W_{0}(x)'$ lt rgb "black"
plot[-4:-1] t*exp(t),t lt 3 title '$W_{-1}(x)$'
产生这个数字:
答案 0 :(得分:2)
它们出现在彼此之上,因为您正在绘制两次(即您正在使用plot
命令两次)。请尝试以下条件图:
plot [-4:4] t*exp(t),(t < -1 ? t : 1/0) title '$W_{0}(x)$' lt rgb "black", \
t*exp(t),(t > -1 ? t : 1/0) lt 3 title '$W_{-1}(x)$'
上述内容不需要multiplot
。