- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我制作了以下 3D 图:
figure
subplot(2,1,1)
hold on
plot3(X_LE, Y_LE,Z, 'red', 'linewidth', 2)
plot3(X_TE, Y_LE,Z, 'red', 'linewidth', 2)
plot3(X_LE, -Y_LE,Z, 'red', 'linewidth', 2)
plot3(X_TE, -Y_LE,Z, 'red', 'linewidth', 2)
plot3([X_LE(end) X_TE(end)],[Y_LE(end) Y_LE(end)],[0 0], 'red', 'linewidth', 2)
plot3([X_LE(end) X_TE(end)],[-Y_LE(end) -Y_LE(end)],[0 0], 'red', 'linewidth', 2)
grid on
axis equal
xlabel('x/b','Interpreter','latex')
ylabel('y/b','Interpreter','latex')
view(-45, 23);
但是,我想创建一个 2x2 子图,其中 4 个子图中的每一个的视角都不同。
与其将整个代码复制 4 次并仅更改视角,是否有一些优雅的方法可以做到这一点?
我试图获得的输出示例:
最佳答案
您可以使用 copyobj
功能。
copyobj
将允许您复制您已经定义的任何图形对象。所以原则是创建你的第一个子图,然后简单地复制它 3 次并调整每个新副本的位置和 View 。
要使用此功能(以及出于许多其他原因),最好保存您创建的图形对象的句柄。这通常是通过将图形指令的返回值分配给变量来完成的。例如:
hp = plot(x,y) ;
会将 plot
对象的句柄保留在变量 hp
中,因此您始终可以使用此句柄来修改线条属性。
对于您的具体情况,它会像这样:
%% Quick mock up of a 3D triangle (you did not give any sample data)
x = [0 ; 2 ; 1 ; 0 ] ;
y = [3 ; 1 ; 5 ; 3 ] ;
z = [2 ; -1 ; 4 ; 2 ] ;
%% use dummy subplots, just to save their position on a figure
hf = figure ;
for k=1:4
hs = subplot(2,2,k) ;
axpos{k,1} = hs.OuterPosition ;
end
clf(hf) ; % clear all subplots, keep only "axpos" and the empty figure
%% Generate the first subplot
%% (use your own code for that, but don't forget to retrieve the handles of the figure and the axes)
figure(hf) ;
% hs(1) = subplot(2,2,1) ; % use the line below instead. It is equivalent
% and it also set the 'hold on' mode for the axe
hs(1) = axes('parent',hf, 'OuterPosition',axpos{1},'NextPlot','add') ;
hp = plot3(x,y,z,'red', 'linewidth', 2) ;
grid on
axis equal
xlabel('x/b','Interpreter','latex')
ylabel('y/b','Interpreter','latex')
view(-45, 23);
%% Now use "copyobj" to copy the full axes object with the content and labels
for k=2:4
hs(k) = copyobj( hs(1) , hf ) ; % create a copy of the full subplot
set( hs(k) , 'OuterPosition',axpos{k} ) % reposition it so it doesn't overlap the original
end
然后你所要做的就是根据你的需要改变每个子图的 View 。这可以通过使用子图句柄作为 view
指令的第一个参数来完成。例如:
%% adjust the view of each subplot
view( hs(2) , 25,40)
view( hs(3) , -25,32)
view( hs(4) , 37,92)
注意:如果你事先知道你想要的 View ,你也可以在开始时将值放在一个数组中,并在你调整它们位置的循环中直接设置每个轴 View 。
关于matlab - 四个不同视角的相同子图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53448946/
我想知道哪个插件在 eclipse 中提供 Java 视角?相同的插件是否有助于创建新的 Java 项目?如果不是哪个插件贡献了它? 最佳答案 org.eclipse.jdt.ui插件提供java视角
每当我在 Eclipse 中打开 Java 透视图时,它就会如图所示。Java EE 的观点完全没问题。有人遇到同样的问题并解决了吗? 最佳答案 尝试重新调整你的观点。已选择 Java 透视图后,转到
我在基于社区服务器的平台上有一个博客,我想将其移至 Wordpress。由于这是一个我已经加入的社区,我不想失去该社区的固定读者,所以我计划交叉发布我在社区服务器平台上发布的每一个新帖子。我将发布博客
我正在尝试从旧的 Android 相机 API 切换到新的 CameraX API。我正在为增强现实应用程序使用预览模式,我需要获取一些信息,例如预览使用的相机的视角和大小。 到目前为止,这是我的代码
我们有一个快捷键可以从调用方法的任何地方跳转到方法定义,即通过在方法名称上使用 Ctrl+左键单击。但是,如果我当前位于方法定义上并且我想要转到调用或使用该方法的位置,该怎么办?这有什么捷径吗? 我已
我试图改变我的图的一个子图中的角度,它是一个 3d 图。我愿意: import matplotlib.pyplot as plt f1 = plt.figure() ax1 = f1.add_subp
可以使用 -perspective idPerspective 启动 eclipse 那么我怎样才能得到这个 idPerspective 呢? 最佳答案 如果您正在使用 PDE(插件开发环境)运行 E
我有标准版的 eclipse Galileo。现在我想在上面开发企业应用程序。知道如何获得 Java EE 视角吗?标准版如何安装Java EE工具? 最佳答案 我也遇到了同样的问题。我首先使用 Ub
我创建了一个简单的 Eclipse 插件,它只是从菜单中的命令打开一个新 View 。我正在使用 Eclipse RCP 2018,当我将插件作为应用程序运行时,一切看起来与添加了菜单选项的 java
我使用 C# 和 .NET 已经有一段时间了,尽管我之前一直使用 OOP 语言(更准确地说是 Java),但在处理 .NET 应用程序时,我发现接口(interface)使用的比我在 java 见过。
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 7年前关闭。 Improve t
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 9 年前。 Improve this
当我调试 Android 应用程序时,它会从 Java 角度激活“调试”角度;但当我使用红色终止按钮终止应用程序时,它不会切换回 Java 视角。 最佳答案 可能的重复:In Eclipse, how
如果使用 Eclipse EE,是否有任何理由使用 Java Perspective 而不是 Java EE Perspective?换句话说,对于 Eclipse EE,Java Perspecti
我是一名优秀的程序员,十分优秀!