Auswahl Aktion im Forum Suche Kontakt Für Mitglieder Mathematisch für Anfänger Wer ist Online | |
| Autor |
Gnuplot: 3D Plotten aus beliebigen Dateien |
|
bloom57
Neu  Dabei seit: 06.08.2012 Mitteilungen: 1
Aus:
 |     Themenstart: 2012-08-06 16:34
|
Sorry für das Deutsche, ich habe die selbe Frage anderen englischsprachigen Foren gestellt und war zu faul, um alles zu übersetzen :-)
Dear folks, I’d be very glad if you could give me some advice on that:
I want to produce three-dimensional graphics from data files existing in an arbitrary format.
A typical example is ‘glas.dat’ (fairly long, please skip most of it while reading it):
0.568000 0.000000 -0.911000
0.518894 0.231026 -0.911000
0.380066 0.422106 -0.911000
0.175522 0.540200 -0.911000
-0.059372 0.564888 -0.911000
-0.284000 0.491902 -0.911000
-0.459522 0.333862 -0.911000
-0.555588 0.118094 -0.911000
-0.555588 -0.118094 -0.911000
-0.459522 -0.333862 -0.911000
-0.284000 -0.491902 -0.911000
-0.059372 -0.564888 -0.911000
0.175522 -0.540200 -0.911000
0.380066 -0.422106 -0.911000
0.518894 -0.231027 -0.911000
0.568000 -0.000000 -0.911000
0.341741 0.000000 -0.905215
0.312196 0.138999 -0.905215
0.228669 0.253963 -0.905215
0.105604 0.325015 -0.905215
-0.035722 0.339869 -0.905215
-0.170870 0.295956 -0.905215
-0.276474 0.200870 -0.905215
-0.334273 0.071052 -0.905215
-0.334273 -0.071052 -0.905215
-0.276474 -0.200870 -0.905215
-0.170871 -0.295956 -0.905215
-0.035722 -0.339869 -0.905215
0.105604 -0.325015 -0.905215
0.228669 -0.253963 -0.905215
0.312196 -0.138999 -0.905215
0.341741 -0.000000 -0.905215
0.212153 0.000000 -0.863178
0.193812 0.086290 -0.863178
0.141958 0.157661 -0.863178
0.065559 0.201770 -0.863178
-0.022176 0.210991 -0.863178
-0.106077 0.183730 -0.863178
-0.171636 0.124701 -0.863178
-0.207517 0.044109 -0.863178
-0.207517 -0.044109 -0.863178
-0.171636 -0.124701 -0.863178
-0.106077 -0.183730 -0.863178
-0.022176 -0.210991 -0.863178
0.065559 -0.201770 -0.863178
0.141958 -0.157661 -0.863178
0.193812 -0.086291 -0.863178
0.212153 -0.000000 -0.863178
0.138097 0.000000 -0.764660
0.126157 0.056169 -0.764660
0.092405 0.102626 -0.764660
0.042674 0.131338 -0.764660
-0.014435 0.137340 -0.764660
-0.069048 0.119595 -0.764660
-0.111722 0.081171 -0.764660
-0.135079 0.028712 -0.764660
-0.135079 -0.028712 -0.764660
-0.111722 -0.081171 -0.764660
-0.069048 -0.119595 -0.764660
-0.014435 -0.137340 -0.764660
0.042674 -0.131338 -0.764660
0.092405 -0.102626 -0.764660
0.126157 -0.056169 -0.764660
0.138097 -0.000000 -0.764660
0.098588 0.000000 -0.618872
0.090065 0.040099 -0.618872
0.065968 0.073265 -0.618872
0.030465 0.093763 -0.618872
-0.010305 0.098048 -0.618872
-0.049294 0.085380 -0.618872
-0.079760 0.057949 -0.618872
-0.096434 0.020498 -0.618872
-0.096434 -0.020498 -0.618872
-0.079760 -0.057949 -0.618872
-0.049294 -0.085380 -0.618872
-0.010305 -0.098048 -0.618872
0.030465 -0.093763 -0.618872
0.065968 -0.073265 -0.618872
0.090065 -0.040099 -0.618872
0.098588 -0.000000 -0.618872
0.084164 0.000000 -0.452254
0.076887 0.034232 -0.452254
0.056317 0.062546 -0.452254
0.026008 0.080044 -0.452254
-0.008798 0.083703 -0.452254
-0.042082 0.072888 -0.452254
-0.068090 0.049470 -0.452254
-0.082325 0.017499 -0.452254
-0.082325 -0.017499 -0.452254
-0.068090 -0.049470 -0.452254
-0.042082 -0.072888 -0.452254
-0.008798 -0.083703 -0.452254
0.026008 -0.080045 -0.452254
0.056317 -0.062546 -0.452254
0.076887 -0.034233 -0.452254
0.084164 -0.000000 -0.452254
0.092386 0.000000 -0.291706
0.084399 0.037577 -0.291706
0.061819 0.068656 -0.291706
0.028549 0.087865 -0.291706
-0.009657 0.091880 -0.291706
-0.046193 0.080009 -0.291706
-0.074742 0.054303 -0.291706
-0.090368 0.019208 -0.291706
-0.090368 -0.019208 -0.291706
-0.074742 -0.054303 -0.291706
-0.046193 -0.080009 -0.291706
-0.009657 -0.091880 -0.291706
0.028549 -0.087865 -0.291706
0.061819 -0.068656 -0.291706
0.084399 -0.037577 -0.291706
0.092386 -0.000000 -0.291706
0.124988 0.000000 -0.153861
0.114183 0.050837 -0.153861
0.083634 0.092885 -0.153861
0.038624 0.118871 -0.153861
-0.013065 0.124304 -0.153861
-0.062494 0.108243 -0.153861
-0.101118 0.073466 -0.153861
-0.122257 0.025987 -0.153861
-0.122257 -0.025987 -0.153861
-0.101118 -0.073466 -0.153861
-0.062494 -0.108243 -0.153861
-0.013065 -0.124304 -0.153861
0.038624 -0.118871 -0.153861
0.083634 -0.092885 -0.153861
0.114183 -0.050837 -0.153861
0.124988 -0.000000 -0.153861
0.185015 0.000000 -0.041791
0.169020 0.075253 -0.041791
0.123799 0.137493 -0.041791
0.057173 0.175960 -0.041791
-0.019339 0.184002 -0.041791
-0.092508 0.160228 -0.041791
-0.149681 0.108749 -0.041791
-0.180972 0.038467 -0.041791
-0.180972 -0.038467 -0.041791
-0.149681 -0.108749 -0.041791
-0.092508 -0.160228 -0.041791
-0.019339 -0.184002 -0.041791
0.057173 -0.175960 -0.041791
0.123799 -0.137493 -0.041791
0.169020 -0.075253 -0.041791
0.185015 -0.000000 -0.041791
0.273264 0.000000 0.053395
0.249639 0.111146 0.053395
0.182849 0.203075 0.053395
0.084443 0.259889 0.053395
-0.028564 0.271767 0.053395
-0.136632 0.236653 0.053395
-0.221075 0.160620 0.053395
-0.267292 0.056815 0.053395
-0.267292 -0.056815 0.053395
-0.221075 -0.160620 0.053395
-0.136632 -0.236653 0.053395
-0.028564 -0.271767 0.053395
0.084443 -0.259889 0.053395
0.182849 -0.203075 0.053395
0.249639 -0.111146 0.053395
0.273264 -0.000000 0.053395
0.384384 0.000000 0.149114
0.351152 0.156343 0.149114
0.257203 0.285653 0.149114
0.118781 0.365570 0.149114
-0.040179 0.382278 0.149114
-0.192192 0.332886 0.149114
-0.310973 0.225935 0.149114
-0.375984 0.079918 0.149114
-0.375984 -0.079918 0.149114
-0.310973 -0.225935 0.149114
-0.192192 -0.332886 0.149114
-0.040179 -0.382278 0.149114
0.118781 -0.365571 0.149114
0.257203 -0.285653 0.149114
0.351152 -0.156343 0.149114
0.384384 -0.000000 0.149114
0.504089 0.000000 0.267473
0.460508 0.205031 0.267473
0.337301 0.374611 0.267473
0.155772 0.479417 0.267473
-0.052692 0.501327 0.267473
-0.252044 0.436554 0.267473
-0.407816 0.296296 0.267473
-0.493073 0.104806 0.267473
-0.493073 -0.104806 0.267473
-0.407816 -0.296296 0.267473
-0.252044 -0.436554 0.267473
-0.052692 -0.501327 0.267473
0.155772 -0.479417 0.267473
0.337301 -0.374611 0.267473
0.460508 -0.205031 0.267473
0.504089 -0.000000 0.267473
0.609609 0.000000 0.430046
0.556906 0.247950 0.430046
0.407908 0.453028 0.430046
0.188380 0.579773 0.430046
-0.063721 0.606270 0.430046
-0.304805 0.527937 0.430046
-0.493184 0.358319 0.430046
-0.596288 0.126745 0.430046
-0.596288 -0.126745 0.430046
-0.493184 -0.358319 0.430046
-0.304805 -0.527937 0.430046
-0.063722 -0.606270 0.430046
0.188380 -0.579773 0.430046
0.407908 -0.453028 0.430046
0.556906 -0.247951 0.430046
0.609609 -0.000000 0.430046
0.675154 0.000000 0.647779
0.616784 0.274610 0.647779
0.451766 0.501737 0.647779
0.208634 0.642110 0.647779
-0.070573 0.671455 0.647779
-0.337577 0.584700 0.647779
-0.546211 0.396846 0.647779
-0.660400 0.140372 0.647779
-0.660400 -0.140372 0.647779
-0.546211 -0.396845 0.647779
-0.337577 -0.584700 0.647779
-0.070573 -0.671455 0.647779
0.208634 -0.642110 0.647779
0.451766 -0.501737 0.647779
0.616784 -0.274610 0.647779
0.675154 -0.000000 0.647779
0.681825 0.000000 0.900691
0.622878 0.277323 0.900691
0.456230 0.506695 0.900691
0.210696 0.648454 0.900691
-0.071270 0.678090 0.900691
-0.340913 0.590478 0.900691
-0.551608 0.400767 0.900691
-0.666926 0.141760 0.900691
-0.666926 -0.141759 0.900691
-0.551608 -0.400767 0.900691
-0.340913 -0.590478 0.900691
-0.071270 -0.678090 0.900691
0.210695 -0.648454 0.900691
0.456230 -0.506695 0.900691
0.622878 -0.277324 0.900691
0.681825 -0.000000 0.900691
0.626000 0.000000 1.101000
0.571879 0.254617 1.101000
0.418876 0.465209 1.101000
0.193445 0.595361 1.101000
-0.065435 0.622571 1.101000
-0.313000 0.542132 1.101000
-0.506445 0.367954 1.101000
-0.612320 0.130153 1.101000
-0.612320 -0.130153 1.101000
-0.506445 -0.367953 1.101000
-0.313000 -0.542132 1.101000
-0.065435 -0.622571 1.101000
0.193444 -0.595361 1.101000
0.418876 -0.465209 1.101000
0.571879 -0.254617 1.101000
0.626000 -0.000000 1.101000
If I want to create a nice 3D surface, I write:
splot 'glass.dat' every 2::0::12 with lines
and I get a nice glass.
The problem now is that if I erase the blank lines separating the different parts of the plot (according to z values), the three-dimensional structure gets lost.
If I erase them all, it's no longer possible to produce the graphic.
My goal is as follows: regardless of the form and structure of the data file containing the 3d data 'data.dat', I'd like to plot them out and obtain meaningful surfaces like in the glass case.
Do you think such a purpose is realistic? If yes, how should I proceed?
Many thanks for your guidance guys!
|
Profil
Quote
Link | Folgende Antworten hat der Fragesteller vermutlich noch nicht gesehen. Er/sie war noch nicht wieder auf dem Matheplaneten |
syngola
Senior  Dabei seit: 21.10.2003 Mitteilungen: 2396
Aus: Edinburgh
 |     Beitrag No.1, eingetragen 2012-08-06 16:53
|
Hi,
maybe i skipped too much while reading it, but could you provide any information about the program you use to plot? From what program does this output come from?
regards, Peter
|
Profil
Quote
Link |
matph
Senior  Dabei seit: 20.11.2006 Mitteilungen: 3799
Aus: A
 |     Beitrag No.2, eingetragen 2012-08-06 17:02
|
Hi,
Why do you want to destroy the data blocks?
If you don't have any blocks, you can construct them, e.x. by scripting
--
matph
----------------- Wir müssen wissen, wir werden wissen. Hilbert
Das Buch der Natur ist in der Sprache der Mathematik geschrieben. Galilei
[ Nachricht wurde editiert von matph am 06.08.2012 17:16:50 ]
|
Profil
Quote
Link |
syngola
Senior  Dabei seit: 21.10.2003 Mitteilungen: 2396
Aus: Edinburgh
 |     Beitrag No.3, eingetragen 2012-08-06 17:08
|
Hi,
just saw that Gnuplot is the program of choice. Can you provide a minimal example with the effect you describe? what is the error message?
I just tried to use your data and it plots perfectly with any blank lines at any position...
after some trial and error (and some tips) it seems that every block codes for points in a z-plane. points between z-planes are connected if the number of lines in each block is equal. with your modification the points are not connected properly.
that's it for me, i leave the battle field for someone who knows what he/she is writing.
regards, Peter
[ Nachricht wurde editiert von syngola am 06.08.2012 18:04:16 ]
|
Profil
Quote
Link |
viertel
Senior  Dabei seit: 04.03.2003 Mitteilungen: 21550
Aus: Hessen
 |     Beitrag No.4, eingetragen 2012-08-06 17:24
|
2012-08-06 16:53 - syngola in Beitrag No. 1 schreibt:
From what program does this output come from? glass.dat is a demo file delivered with gnuplot.
-----------------
[ Nachricht wurde editiert von viertel am 06.08.2012 17:25:47 ]
|
Profil
Quote
Link |
|