- 积分
- 1
- 注册时间
- 2008-1-22
- 仿真币
-
- 最后登录
- 1970-1-1
|
在 http://mathforum.org/kb/message.jspa?messageID=779634&tstart=26820 上看到这样一段代码:- FunnyPlot[pp_Graphics, opts___Rule] :=
- Module[{sol1, sol2, lis, GAP, qq, x, y}, {sol1, sol2} =
- AbsoluteOptions[pp, Ticks][[2]];
- lis = Select[
- Flatten[Cases[
- sol2, {x1_,
- x2_, {x3_, x4_}, {GrayLevel[0.], AbsoluteThickness[0.25]}}]],
- NumericQ];
- GAP = Max[lis] - Min[lis];
- qq[x_] := If[FractionalPart[x] === 0., IntegerPart[x], x];
- Show[pp /. {x_, y_} -> {x, GAP - y}, Evaluate[opts],
- AxesOrigin ->
- AbsoluteOptions[pp, AxesOrigin][[2]] /. {x_, y_} -> {x, GAP - y},
- Ticks ->
- MapAll[qq, {sol1,
- Map[{GAP - First[#], Sequence @@ Rest[#]} &, sol2]}]]]
- pp = Plot[x^3, {x, -3, 2}, PlotRange -> All];
- FunnyPlot[pp]
- pp = Plot[x^3, {x, 1, 2}, PlotRange -> All];
- FunnyPlot[pp]
- pp = Plot[Sin[x], {x, -\[Pi], \[Pi]}];
- FunnyPlot[pp, PlotLabel -> "Peekaboo"]
复制代码
原作者说 It seems to work rather nicely,但是我运行后一大堆错误,没有图形输出。可能是 Mathematica的版本问题,麻烦大家帮忙看看错误,改正,使得Mathematica 7.0 能够正确运行。 |
|