调整 Mathematica 中图像列表的大小以与 ListAnimate 一起使用
假设我们有一个图像列表,如下所示:
imageList = Table[Plot[Sin[k*x], {x, 0, 2 Pi}], {k, 1, 4, .05}];
我们可以像这样对这些图像进行动画处理:
ListAnimate[imageList]
但现在假设我们希望动画更大。 我们可以将 ImageSize 选项添加到用于生成图像的 Plot 命令中,但假设我们不允许篡改 imageList。
我们可以手动调整列表动画中每个帧的大小。 这确实可行,但是我们怎样才能不那么乏味地实现这一点呢?
Suppose we have a list of images, like the following:
imageList = Table[Plot[Sin[k*x], {x, 0, 2 Pi}], {k, 1, 4, .05}];
We can animate those images like so:
ListAnimate[imageList]
But now suppose we want the animation bigger.
We could stick an ImageSize option into the Plot command used to generate the images, but suppose we're not allowed to tamper with imageList.
We could manually resize each frame in the list animation.
That works, but how can we accomplish that less tediously?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
关键选项是
ImageSize
。您可以将其与各种绘图命令以及Show
和Export
一起使用。ImageSize
可以指定为{,}
(其中任一可以是Automatic
,以便根据AspectRatio
)或
,它是{, Automatic}
的缩写。简而言之,你可以做类似的事情如果你真的想控制图形布局,你还需要开始使用
ImagePadding
和PlotRangePadding
,但要做好灰色准备头发如果往这个方向走!编辑:对于您在
imageList
中已生成图形的特定情况,它们都像这样组合在一起The key option is
ImageSize
. You can use it with the various plot commands, as well as withShow
andExport
.ImageSize
can be given as{<width>,<height>}
(where either can beAutomatic
to have the other set according toAspectRatio
) or as<width>
which is short for{<width>, Automatic}
. In short, you can do stuff likeIf you really want control of the graphics layout, you need to start playing around with
ImagePadding
andPlotRangePadding
as well, but be prepared for gray hair if you go in this direction!Edit: For your particular case with the graphics already generated in
imageList
, it all comes together like so我对你的问题有点困惑。
对我来说效果很好,因为它可以绘制指定尺寸的图像。我承认这个例子有点混乱。 ListAnimate 命令还可以创建一个面板,其框架足够大,可以容纳本例中最大的图形。
如果我回答了错误的问题,请再次发帖,这是我的专长之一。
I'm a bit puzzled by your question.
works fine for me, in as much as it draws the images with the specified sizes. It's a bit of a mess in this example, I grant you. The ListAnimate command also makes a panel with a frame big enough for the largest graphic in this case.
Post again if I've answered the wrong question for you, that's one of my specialities.
以下是对当前措辞的问题的一个可行答案,感谢 高性能标记 和 Janus:
The following is one viable answer to the question as currently worded, with thanks to the initial answers by High Performance Mark and Janus: