使用图中的缩放工作

时间:2015-10-08 17:16:26

标签: matlab zoom

我在matlab中运行以下代码

@Path("hello")
public class RestController {

@GET
@Path("{param}")

public Response getMsg(@PathParam("param") String msg) {

    String output = "Hello : " + msg;

    return Response.status(200).entity(output).build();

}

}

我获得此enter image description here

但是当我放大左图时,获得此图enter image description here,即占据整个图像。有什么问题?

3 个答案:

答案 0 :(得分:2)

看看这个official article on zoom

  

三维变焦不会改变轴限制,如二维变焦。相反,它会更改视图(特别是轴CameraViewAngle属性),就好像您正在通过带变焦镜头的相机一样。

所以我认为你所描述的行为并不令人惊讶。为了实现类似的2D缩放,我认为可以使用axis来更改限制。也许是这样的

figure
t = 0:pi/50:10*pi;
subplot(1,2,1); plot3(sin(t),cos(t),t);
ax1=gca;
title('Normal');
subplot(1,2,2); plot3(sin(t),cos(t),t); 
axis equal;
title('Axis equal')

% zoom by factor k
fzoom = @(x,k) ([-(x(2)-x(1))/k,(x(2)-x(1))/k] + (x(2)+x(1))) /2;

% get current axis limits
lims = axis(ax1);
x = lims(1:2);
y = lims(3:4);
z = lims(5:6);

% Zoom in every dimensions 120%
axis(ax1,[fzoom(x,1.2),fzoom(y,1.2),fzoom(z,1.2)]);

答案 1 :(得分:-1)

您可以尝试将两个子图的相机位置链接到:

figure
t = 0:pi/50:10*pi;
s(1) = subplot(1,2,1); plot3(sin(t),cos(t),t);
title('Normal');
s(2) = subplot(1,2,2); plot3(sin(t),cos(t),t); 
axis equal;
title('Axis equal')

linkprop(s, 'CameraPosition'); %link the cameraposition

您也可以尝试更改渲染器模式:

set(gcf, 'Renderer', 'painters'); %3 choices: 'painters','opengl','zbuffer'

答案 2 :(得分:-1)

  1. 尝试更改图形渲染器。它曾帮助我解决类似的问题。

  2. 如果仍然无法正常工作。你可以通过addlistener命令监听xlim或ylim属性来解决这个问题。并且作为回调,将轴外部位置设置为正确的值。