在R和gnuplot中绘制大量的x,y,z点用于3D绘图,并在每个时间步长提取bmp / gif / png文件(Plotting large number of x, y, z points for

编程入门 行业动态 更新时间:2024-10-25 17:27:23
在R和gnuplot中绘制大量的x,y,z点用于3D绘图,并在每个时间步长提取bmp / gif / png文件(Plotting large number of x, y, z points for 3D plot in R and gnuplot and extracting bmp/gif/png files at each timestep)

我有大量的x,y,z点(8000点),其中x和y是固定的,z坐标在每个时间步长(大约100个时间步长)发生变化。每个时间步都有一个单独的数据文件(x,y) ,z)每个时间步。 为每个文件绘制这些数据点的最佳方法是什么,以便及时显示z坐标的变化? 可以在每个时间步骤生成3D表面/散点图,并使用这些gif / bmp文件制作视频文件。 我可以使用绘图软件在每个时间步骤绘制x,y,z,但手动操作100次会很繁琐。 你能告诉我一个在R和gnuplot中做到这一点的方法吗? 我想创建像这里链接的图片文件。 http://dl.dropbox.com/u/9267983/stack/1.gif

谢谢

例如,我在特定时间的数据集= 1.0分钟

4.00 4.00 126.6310 8.00 4.00 126.3585 12.00 4.00 126.1797 16.00 4.00 126.0514 20.00 4.00 125.8081 24.00 4.00 125.3174 28.00 4.00 124.6824 32.00 4.00 124.0422 36.00 4.00 123.4376 40.00 4.00 122.8637 44.00 4.00 122.4779 48.00 4.00 122.4673 52.00 4.00 122.4825 56.00 4.00 122.2762 60.00 4.00 122.5483 64.00 4.00 122.0322 68.00 4.00 122.5442 72.00 4.00 122.2031 76.00 4.00 122.4452 80.00 4.00 122.3936 84.00 4.00 122.4258 88.00 4.00 122.4239 92.00 4.00 122.4239 96.00 4.00 122.4226

I have large set of x, y, z points (8000 points) where x, and y are fixed and z-coordinates change at each time step (around 100 time steps).Each time step has a separate data file(x,y,z) for each time step. What would be best way to plot these data points for each file to show the change of z-coordinates in time? May be produce 3D surface/scatter plot at each time step and use those gif/bmp files to make a video file. I can use plotting software to plot x, y, z at each time step but that would be tedious to do it 100 times manually. Can you please suggest me a way to do it in R and gnuplot? I want to create picture files like the one linked here. http://dl.dropbox.com/u/9267983/stack/1.gif

Thank you

For example my data sets at a particular time = 1.0 min

4.00 4.00 126.6310 8.00 4.00 126.3585 12.00 4.00 126.1797 16.00 4.00 126.0514 20.00 4.00 125.8081 24.00 4.00 125.3174 28.00 4.00 124.6824 32.00 4.00 124.0422 36.00 4.00 123.4376 40.00 4.00 122.8637 44.00 4.00 122.4779 48.00 4.00 122.4673 52.00 4.00 122.4825 56.00 4.00 122.2762 60.00 4.00 122.5483 64.00 4.00 122.0322 68.00 4.00 122.5442 72.00 4.00 122.2031 76.00 4.00 122.4452 80.00 4.00 122.3936 84.00 4.00 122.4258 88.00 4.00 122.4239 92.00 4.00 122.4239 96.00 4.00 122.4226

最满意答案

根据您的样本数据,我生成了一组假数据并生成了一系列图表并将其保存为单个图像(按顺序命名)。 可以使用ImageMagick,QuickTime Pro,GIMP或任何其他功能强大的图形编辑器将这些图像转换为动画gif或电影文件。

在此处输入图像描述

下面是我的gnuplot代码。 请注意,在gnuplot版本4.6中新引入了do循环,并且在早期版本中不起作用。 使用旧版本的gnuplot,您可以使用外部shell脚本多次运行相同的脚本,同时更改输出文件名和数据文件名以生成相同的结果。

set term pngcairo set palette defined ( 0 '#000fff',\ 0.99 '#000fff',\ 1 '#90ff70',\ 1.99 '#90ff70',\ 2 '#ee0000',\ 2.99 '#ee0000') set ticslevel 0 set view 51,120 do for [t=0:29] { set output sprintf("%d.png", t) splot sprintf("< awk '{if ($2!=prev) print ; prev=$2; print $0}' %d.dat", t) w p pt 7 linecolor palette notitle }

Based on your sample data, I generated a set of fake data and generated a series of plots and saved them as an individual images (sequentially named). Such images can be converted to animated gif or movie files using ImageMagick, QuickTime Pro, GIMP, or any other capable graphics editor.

enter image description here

Below is my gnuplot code. Note that do-loops are newly introduced in gnuplot version 4.6 and will not work in earlier versions. With an older version of gnuplot, you can use an external shell script to run the same script multiple times while changing the output file name and the data file name to produce the same result.

set term pngcairo set palette defined ( 0 '#000fff',\ 0.99 '#000fff',\ 1 '#90ff70',\ 1.99 '#90ff70',\ 2 '#ee0000',\ 2.99 '#ee0000') set ticslevel 0 set view 51,120 do for [t=0:29] { set output sprintf("%d.png", t) splot sprintf("< awk '{if ($2!=prev) print ; prev=$2; print $0}' %d.dat", t) w p pt 7 linecolor palette notitle }

更多推荐

本文发布于:2023-07-20 12:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1199655.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:步长   并在   文件   时间   gif

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!