找回密码
 注册
Simdroid-非首页
查看: 65|回复: 0

[图形图像] 【转发】how to invert the x or y axis

[复制链接]
发表于 2010-1-27 14:08:30 | 显示全部楼层 |阅读模式 来自 华南理工大学
http://mathforum.org/kb/message.jspa?messageID=779634&tstart=26820 上看到这样一段代码:
  1. FunnyPlot[pp_Graphics, opts___Rule] :=
  2. Module[{sol1, sol2, lis, GAP, qq, x, y}, {sol1, sol2} =
  3. AbsoluteOptions[pp, Ticks][[2]];
  4. lis = Select[
  5. Flatten[Cases[
  6. sol2, {x1_,
  7. x2_, {x3_, x4_}, {GrayLevel[0.], AbsoluteThickness[0.25]}}]],
  8. NumericQ];
  9. GAP = Max[lis] - Min[lis];
  10. qq[x_] := If[FractionalPart[x] === 0., IntegerPart[x], x];
  11. Show[pp /. {x_, y_} -> {x, GAP - y}, Evaluate[opts],
  12. AxesOrigin ->
  13. AbsoluteOptions[pp, AxesOrigin][[2]] /. {x_, y_} -> {x, GAP - y},
  14. Ticks ->
  15. MapAll[qq, {sol1,
  16. Map[{GAP - First[#], Sequence @@ Rest[#]} &, sol2]}]]]

  17. pp = Plot[x^3, {x, -3, 2}, PlotRange -> All];
  18. FunnyPlot[pp]
  19. pp = Plot[x^3, {x, 1, 2}, PlotRange -> All];
  20. FunnyPlot[pp]
  21. pp = Plot[Sin[x], {x, -\[Pi], \[Pi]}];
  22. FunnyPlot[pp, PlotLabel -> "Peekaboo"]
复制代码


原作者说 It seems to work rather nicely,但是我运行后一大堆错误,没有图形输出。可能是 Mathematica的版本问题,麻烦大家帮忙看看错误,改正,使得Mathematica 7.0 能够正确运行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-5-2 22:50 , Processed in 0.029586 second(s), 14 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表