wolfram-mathematica - 如何在 Mathematica 中获得 Wolfram|Alpha 2D 图形的十字准线行为?

标签 wolfram-mathematica wolframalpha

当鼠标光标在 Wolfram|Alpha 中的 2D 绘图上时,会出现一对灰线,帮助您读取 x 和 y 轴的坐标 .
For example ,我将鼠标悬停在以下 Airy 函数图中的转折点之一上。

Web

上述内容也可以在 Mathematica 中使用

WolframAlpha["Plot Ai(x)", {{"Plot", 1}, "Content"}]

Nb

它具有某种定位器的附加优势,可以显示坐标 .

如何在普通的 Mathematica 图形/绘图中模拟这种行为?

最佳答案

这是您在评论中要求的功能之一:

locatorPlot[func_, r : {var_, __}, other___] :=
 LocatorPane[
   Dynamic[pos, (pos = {#, func /. var -> #}) & @@ # &],
   Column[{Plot[func, r, other], Dynamic@pos}],
   AutoAction -> True,
   Appearance ->
     Graphics[{Gray, Line @ {{{-1, 0}, {1, 0}}, {{0, -1}, {0, 1}}}},
       ImageSize -> Full]
 ]

locatorPlot[AiryAi[z], {z, -11, 5}, ImageSize -> 400]

enter image description here

这是一个相当笨重的更新来处理您的新请求:
locatorPlot[func_List, r : {var_, __}, other___] :=
 DynamicModule[{pos, pos2},
  LocatorPane[
   Dynamic[pos, (pos = #; (pos2 = {#, First@Nearest[func /. var -> #, #2]}) & @@ #) &],
   Plot[func, r, other,
     Epilog ->
      {Text[\[GrayCircle], Dynamic@pos2], Text[Dynamic@pos2, Dynamic@pos2, {-1.2, 0}]}
   ],
   AutoAction -> True,
   Appearance -> 
     Graphics[{Gray, Line@{{{-1, 0}, {1, 0}}, {{0, -1}, {0, 1}}}}, ImageSize -> Full]
   ]
  ]

locatorPlot[{AiryAi[z], Sin[z]}, {z, -11, 5}, ImageSize -> 400]

关于wolfram-mathematica - 如何在 Mathematica 中获得 Wolfram|Alpha 2D 图形的十字准线行为?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8222733/

相关文章:

wolfram-mathematica - Mathematica中的计算几何包和 “Nontensor object generated”

java - android Wolfram alpha 异常下载网址

matlab - Wolfram Alpha 和 MATLAB 以不同方式绘制传递函数

function - Mathematica 中的可选命名参数

graph - 用不同的范数绘制 VoronoiDiagram

python - SciPy 中的二维积分

python - Sympy 和 Wolframalpha 给出不同的结果

math - 比较传统数学符号与 APL/J 符号的示例

ios - WolframAlpha API 高分辨率图像

wolfram-mathematica - Mathematica 二维极限计算