如何使用 LevelScheme 在 Mathematica 中创建子图?
以 MATLAB 中生成的以下任意图形为例。基本想法是我有一个等高线图,我想在右侧的子图中展示从中选择的切片。 mma中有相当于subplot的吗?
我现在所做的工作是只绘制带有切片和箭头的等高线图以及分别的两个切片图,然后将它们放在乳胶中。不过,我希望能够在 mma 内做到这一点。我该怎么做呢?
我的一个想法是生成一个具有完整垂直和垂直方向的等高线图。半水平纵横比,这两个图具有半垂直和半垂直的比例。一半水平宽高比,然后使用 GraphicsGrid 将它们对齐。但这仍然给我提供了列表形式的图,而不是复合图。这是唯一的方法还是有更好、更优雅的方法?
Consider the following arbitrary figure generated in MATLAB as an example. The basic idea is that I have a contour plot and I want to showcase selected slices from it in subplots on the right. Is there an equivalent of subplot in mma?
The work around that I have right now is to have just the contour plot with the slices and the arrows and the two slice-plots separately and then put them together in latex. However, I'd like to be able to do this within mma. How do I go about doing this?
An idea that I had is to generate a the contour plot with a full vertical & half horizontal aspect ratio, the two plots with half vertical & half horizontal aspect ratio, and then use GraphicsGrid
to align them up. But this still gave me the plots as a list, not a composite figure. Is this the only way or is there a nicer, more elegant way of doing it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我知道 LevelScheme 中的
Multipanel
可能可以让你做什么你想要的 - 但我对此没有太多经验,并且文档中的示例相当稀疏。我已经将示例之一粘贴到这个SO中答案,所以看看那里,看看你的想法!
这是我对 GraphicsGrid 的尝试。
Multipanel
可以做但GraphicsGrid
不能做的事情是让您使用不同的列/行大小。
这意味着我很难以编程方式绘制箭头,而是使用“绘图工具”面板 (:D)
编辑:
这里使用
LevelScheme
进行相同的操作,请注意框架对齐。应该可以添加箭头 - 因为
LevelScheme
有很多新的箭头指令 - 但我将把它作为家庭作业问题!I know that
Multipanel
in LevelScheme can probably let you do what you want - but I don't have much experience with it and the examples in the docs are fairly sparse.I've already pasted one of the examples into this SO answer, so have a look there and see what you think!
Here's my attempt with
GraphicsGrid
.The thing that
Multipanel
lets you do butGraphicsGrid
doesn'tis to let you use varying Column/Row sizes.
This means that I struggled to get the arrows drawn in programmatically, and resorted to hand drawing them using the "Drawing Tools" panel ( :D )
Edit:
Here's the same thing using
LevelScheme
, note that the frames line up.It should be possible to add arrows - since
LevelScheme
has lots of new arrow directives - but I'll leave that as a homework problem!关于 GraphicsGrid 的OP评论,您可以使用 FullGraphics@GraphicsGrid@{...} 来获取单个图形对象。这对于获得 PDF 格式的副本也能正常工作是必要的。
Re the OPs comment about GraphicsGrid, you can use FullGraphics@GraphicsGrid@{...} to get a single graphics object out. This is necessary to get copy as PDF to work also.
这是使西蒙的解决方案动态化的第一步。箭头针对该特定图像进行了硬编码。稍后我将尝试更普遍地实施它们。
这是一种稍微不同的方法,它将箭头放在
Epilog
内,将它们的位置链接到左侧图,也许更容易使用。Here is a first pass at making Simon's solution dynamic. The arrows are hard coded for this particular image. Later I shall try to implement them more generally.
Here is a slightly different method that puts the arrows inside
Epilog
, which links their position to the left plot, perhaps easier to use.