是否可以放大区域并将其显示为同一图中的子图?这是我对写意图形的原始尝试,以说明我的问题:
我可以想到使用Plot,然后Epilog,然后我迷失在定位和给出情节自己的起源(当我尝试Epilog时Plot,新的情节位于旧的情节之上,使用旧的原点).
此外,如果可以输入子图的定位将是很好的,因为不同的曲线具有可以用于定位图像的不同"空区域".
我在几篇文章中看过这个,我可以在MATLAB中做到这一点,但我不知道如何在mma中做到这一点.
使用插入.这是一个例子:
f[x_] = Sum[Sin[3^n x]/2^n, {n, 0, 20}];
x1 = x /. FindRoot[f[x] == -1, {x, -2.1}];
x2 = x /. FindRoot[f[x] == -1, {x, -1.1, -1}];
g = Plot[f[x], {x, x1, x2}, AspectRatio -> Automatic,
Axes -> False, Frame -> True, FrameTicks -> None];
{y1, y2} = Last[PlotRange /. FullOptions[g]];
Plot[Sum[Sin[3^n x]/2^n, {n, 0, 20}], {x, -Pi, Pi},
Epilog -> {Line[{
{{x2, y2 + 0.1}, {-0.5, 0.5}}, {{x1, y2 + 0.1}, {-3.5, 0.5}},
{{x1, y1}, {x2, y1}, {x2, y2 + 0.1}, {x1, y2 + 0.1}, {x1,
y1}}}],
Inset[g, {-0.5, 0.5}, {Right, Bottom}, 3]},
PlotRange -> {{-4, 4}, {-3, 3}}, AspectRatio -> Automatic]
Run Code Online (Sandbox Code Playgroud)

并且,借用belisarius的代码,您还可以通过选择x轴上的位置以交互方式选择插入的焦点:
imgsz = 400;
f[x_] := Piecewise[{{Sin@x, Abs@x > .1}, {Sin[100 x], Abs[x] <= 0.1}}];
Manipulate[
Plot[f[x], {x, -3, 3}, PlotRange -> {{-3, 3}, {-2, 5}},
ImageSize -> imgsz,
Epilog ->
Inset[Plot[f[y], {y, p[[1]] - .3, p[[1]] + 0.3}, PlotStyle -> Red,
Axes -> False, Frame -> True, ImageSize -> imgsz/3], {1.5, 3}]],
{{p, {0, 0}}, Locator, Appearance -> None}]
Run Code Online (Sandbox Code Playgroud)
或者,如果您还想以交互方式放置插图:
Manipulate[
Plot[f[x], {x, -3, 3}, PlotRange -> {{-3, 3}, {-2, 5}},
ImageSize -> imgsz,
Epilog ->
Inset[Plot[f[y], {y, p[[1, 1]] - .3, p[[1, 1]] + 0.3},
PlotStyle -> Red, Axes -> False, Frame -> True,
ImageSize -> imgsz/3], p[[2]]]],
{{p, {{0, 0}, {1.5, 3}}}, Locator, Appearance -> None}]
Run Code Online (Sandbox Code Playgroud)
编辑
基于dbjohn问题的另一种选择:
imgsz = 400;
f[x_] := Piecewise[{{Sin@x, Abs@x > .1}, {Sin[100 x], Abs[x] <= 0.1}}];
Manipulate[
Plot[f[x], {x, -3, 3}, PlotRange -> {{-3, 3}, {-2, 5}},
ImageSize -> imgsz,
Epilog ->
Inset[Plot[f[y], {y, p[[1]] - .3, p[[1]] + 0.3}, PlotStyle -> Red,
Axes -> False, Frame -> True, ImageSize -> imgsz/3],
Scaled[zw]]], {{p, {0, 0}}, Locator,
Appearance -> None}, {{zw, {0.5, 0.5}, "Zoom window"}, Slider2D}]
Run Code Online (Sandbox Code Playgroud)

只是一个开始:
imgsz = 400;
f[x_] := Piecewise[{{Sin@x, Abs@x > .1}, {Sin[100 x], Abs[x] <= 0.1}}];
Plot[f[x], {x, -3, 3}, PlotRange -> {{-5, 5}, {-5, 5}},
ImageSize -> imgsz, Epilog ->
Inset[Plot[f[y], {y, -.3, 0.3}, PlotStyle -> Red, Axes -> False,
Frame -> True, ImageSize -> imgsz/3], {3, 3}]]
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
6546 次 |
| 最近记录: |