From: Daniel J S. <dan...@ie...> - 2004-03-03 19:37:28
|
Justace Clutter wrote: >I have been using this ASCII grid format for quite a while now. That is >the definition from the help pages for the matrix datafile format. Am I >wrong with this? > Oh yeah, I forgot about "matrix". The issue there is that "matrix" is designed for 3d data, i.e., splot. (List members, if anything I say here is incorrect, please correct me.) There is a routine in "datafile.c" called df_3dmatrix. I think it only get's called from "plot3d.c". There is no way to call it from "plot2d.c". Inside "datafile.c" where the word "matrix" is tested for there seems to be no test for whether or not the mode is "splot" or "plot". In other words, if I'm not mistaken, Gnuplot should not allow "matrix" to be used in "plot" mode. In the documentation for "matrix" there is reference to a mesh, so I assume there is an "splot" restriction. Actually, in the image patch, I modified things so that a mode variable is passed into that routine so it is possible to identify whether "splot" or "plot" was issued. I probably needed that information for something else, but it could be used to rule out "matrix" when issued with "plot". Or, for that matter plot2d.c could be modified to allow data files in "matrix" format. To you Justace, this is all probably neither here nor there. But it gets back to a point I've tried to make in previous discussions, that 2d and 3d formats have diverged in some ways. I think the "datafile.c" and related routines could be cleaned up a great deal, focusing more on just getting data from a file into Gnuplot and not so much on what the eventually plotting mode will look like. Suffice it to say that "matrix" is currently being ignored in "plot" mode. Sorry. I suppose it would be possible to hack a quick fix together in the image patch (I'm not sure how much work it would take), but I'd prefer to not do that. Instead, I think it would be better for the group to discuss how best to clean up the datafile routines post 4.0, then make the change. I say that because there is the alternative of binary data, and I think it is a better habit to work with binary data for large files. Do developers here agree that, for large files, binary data in "plot" mode is preferable to ascii matrix? Dan >Justace > >On Wed, 2004-03-03 at 10:46, Daniel J Sebald wrote: > > >>Justace Clutter wrote: >> >> >> >>>I like the idea of this pixels based image. The fact that the image >>>could be 10 megs does not bother me. >>> >>> >>> >>Well, in my case my web space is only 10 M. >> >> >> >>> It is the idea that an image could >>>be 120 megs bothers me. So I got the patch and applyed. It did not go >>>clean as one hunk did not make it. But I fixed it by hand. I was >>>patching against 3.8k.1. So, I guess that I do not understand the >>>syntax. Here is the datafile that I have, or really a sample: >>> >>>0.999849 0.652204 0.678995 0.658985 0.585981 0.566624 0.547193 0.615902 >>>0.539023 0.556559 0.547578 0.53746 0.522146 0.535582 0.530735 0.531924 >>>0.554801 0.518362 0.479106 0.527362 0.534836 0.546124 0.522834 0.508155 >>>0.54706 0.469279 0.581292 0.468283 0.535739 0.557979 0.490128 0.536971 >>>0.530735 0.506848 0.523189 0.531732 0.550917 0.484002 0.57789 0.460027 >>>0.556111 0.535427 0.508878 0.558746 0.459494 0.578337 0.45805 0.595234 >>> >>>So I have a grid here, 8x6, that I would like displayed. Each of these >>>floats would need to be mapped onto a color. PM3D did this great. So >>>when I try to use the matrix modifier with just plot it is not happy, >>>then I tried to use splot, still not happy. Here is what I was trying.. >>> >>>gnuplot> plot 'tmp.data' matrix with image >>> >>>GNUPLOT (plot_image): Image grid must be at least 2 x 2. >>> >>>Warning: empty x range [0.999849:0.999849], adjusting to >>>[0.989851:1.00985] >>> >>>GNUPLOT (plot_image): Image grid must be at least 2 x 2. >>> >>>gnuplot> splot 'tmp.data' matrix with image >>> >>>GNUPLOT (plot_image): Image grid must be at least 2 x 2. >>> >>>gnuplot> set view map >>>gnuplot> splot 'tmp.data' matrix with image >>> >>>GNUPLOT (plot_image): Image grid must be at least 2 x 2. >>> >>>gnuplot> >>> >>>Can you give me some ideas on how I can use the image style with this >>>setup? I looked at the information on the image but it seems pretty >>>biased toward images like the tux and not array'd data. Thanks in >>>advance. >>> >>> >>> >>Well, here is the issue. You are putting the data in ASCII format in >>what looks to you like a grid. However, Gnuplot hasn't been set up to >>read ASCII data in such a way. It is set up to read ordered tuples of >>data, such as >> >>x1 y1 z1 >>x2 y2 z2 >>... >> >>where the position is part of the data specification. >> >>Telling Gnuplot what the underlying grid is without specifying it is the >>problem. That is why the "binary" file specifications have extra >>qualifiers to indicate grid dimensions, grid spacing, etc. >> >>Another alternative for binary is "Gnuplot binary" where the first line >>and row of the matrix give the x and y spacing information. I've >>generally not used that for images, but I think it should work. (Type >>"help splot binary" at Gnuplot's command line for more info on that format.) >> >>The reason you may want to avoid putting your image in ASCII format is >>that you are playing the numbers game again. Your example above has 9 >>characters for each pixel element. 1800 x 1800 x 9 or roughly 27 M at a >>minimum, and if when you add the (x,y) coordinates it goes to 81 M. >> That's too big. If in the program or software you are using to >>generate the data you could multiply by 2^16 and then save the values in >>binary as unsigned 16 bit ints you would be better off. Can you do that? >> >>Dan >> >> >> >>>Justace >>> >>>On Wed, 2004-03-03 at 01:00, Daniel J Sebald wrote: >>> >>> >>> >>> >>>>Justace Clutter wrote: >>>> >>>> >>>> >>>> >>>> >>>>>So, >>>>> >>>>> I have this project where I have computed a bunch of channel >>>>>correlations. The entire matrix is like 1800x1800 with one side of the >>>>>diaganal set to NaN since it is symetric. Now to the root of the >>>>>problem. I use the pm3d portion of gnuplot to create a 2D map of the >>>>>matrix. Here is the snipplit of code that I use... >>>>> >>>>> >>>>> >>>>> >>>>> >>>><snip> >>>> >>>> >>>> >>>> >>>> >>>>>I used the first set size command to try to bring the file size down, of >>>>>course it did not work. The resultant file is 120Meg. This is crazy. >>>>>Am I doing somehting wrong? >>>>> >>>>> >>>>> >>>>> >>>>> >>>>Justace, >>>> >>>>Am I understanding correctly that you are essentially attempting to >>>>display an 1800x1800 matrix as an image? Ethan's comment is correct >>>>that each element, i.e., pixel, will be drawn as a rectangle, i.e., >>>>polygon. There is a lot of ASCII text associated with each rectangle. >>>>You might try the image patch on SourceForge (something originally >>>>titled "with pixels"). That will put the image into a PostScript file >>>>in a compact form. >>>> >>>>Realize though that 1800x1800 is a lot of data. Saved as bytes, that >>>>alone would be roughly 3M. I've tried 1000x1000 images with no >>>>problems, but things really do slow down. So, unless it is necessary to >>>>keep such high resolution for the image, your first step might be to >>>>down sample the data appropriately. Keep in mind what your eventual >>>>display will be. (For example, people often put high res photos on >>>>their web pages which take close to a minute to download. However, the >>>>display is usually low resolution so a condensed image would have served >>>>equally well and, in fact, would save space on their server.) Ethan's >>>>suggestion of PNG is a good idea because that inherently brings down the >>>>resolution. >>>> >>>>Dan >>>> >>>> >>>> >>>> >> >> >>------------------------------------------------------- >>SF.Net is sponsored by: Speed Start Your Linux Apps Now. >>Build and deploy apps & Web services for Linux with >>a free DVD software kit from IBM. Click Now! >>http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click >>_______________________________________________ >>gnuplot-beta mailing list >>gnu...@li... >>https://lists.sourceforge.net/lists/listinfo/gnuplot-beta >> >> > > > > > -- Dan Sebald email: daniel DOT sebald AT ieee DOT org URL: http://acer-access DOT com/~dsebald AT acer-access DOT com/ |