|
From: Philipp K. J. <ja...@ie...> - 2009-11-22 02:14:25
|
I am not sure how the "matrix" keyword works (that is: is supposed to work) when used together with the plot (not splot) command. Can you help me to enumerate the legal uses? For splot, there seem to be two legal ways to use matrix: splot "file" matrix and splot "file" matrix u ($1):($2):3 The first assumes the values in the file to be z-values on a regular grid. The second assumes that the z-values are in "column" 3, and allows me to fix the x- and y-coordinates through the "columns" 1 and 2. Is it legal to do either: splot "file" matrix u 1 or splot "file" matrix 1:2 And if so, what do either of them do? For plot (not splot), I am completely confused. Does it even make sense to have the notion of a "matrix" format for plot? The "matrix" keyword seems to suggest that the data is on a regular, 2-dim grid. This notion does not seem to have any meaning for plot. Best, Ph. |
|
From: Ethan M. <merritt@u.washington.edu> - 2009-11-22 04:03:46
|
On Saturday 21 November 2009, Philipp K. Janert wrote:
>
> I am not sure how the "matrix" keyword works
> (that is: is supposed to work) when used together
> with the plot (not splot) command.
I share your confusion.
> Can you help me to enumerate the legal uses?
>
> For splot, there seem to be two legal ways to use
> matrix:
>
> splot "file" matrix
> and
> splot "file" matrix u ($1):($2):3
In addition, ascii matrices and binary matrices are treated
very differently according to the docs.
> The first assumes the values in the file to be z-values
> on a regular grid.
>
> The second assumes that the z-values are in "column"
> 3, and allows me to fix the x- and y-coordinates through
> the "columns" 1 and 2.
>
> Is it legal to do either:
>
> splot "file" matrix u 1
> or
> splot "file" matrix 1:2
>
> And if so, what do either of them do?
>
> For plot (not splot), I am completely confused. Does
> it even make sense to have the notion of a "matrix"
> format for plot? The "matrix" keyword seems to suggest
> that the data is on a regular, 2-dim grid. This notion
> does not seem to have any meaning for plot.
It is clearly useful to have such a capability.
I use it to make heat maps, for instance.
See heatmaps.dem
But whether I use it in the way orginally intended is another
question :-)
Another bizarre property is that the following command can be
used to plot the values in a row of data rather than a column
of data, which is otherwise "impossible" in a normal gnuplot command:
plot 'rowdata' matrix using 1:0
I suspect this was totally unintended. At one point I tried
to figure out if this was generalizable, but I got too confused
and gave it up.
|
|
From: Philipp K. J. <ja...@ie...> - 2009-11-22 06:17:49
|
On Saturday 21 November 2009 07:54:55 pm you wrote: > On Saturday 21 November 2009, Philipp K. Janert wrote: > > I am not sure how the "matrix" keyword works > > (that is: is supposed to work) when used together > > with the plot (not splot) command. > > I share your confusion. ;-) > > > > For plot (not splot), I am completely confused. Does > > it even make sense to have the notion of a "matrix" > > format for plot? The "matrix" keyword seems to suggest > > that the data is on a regular, 2-dim grid. This notion > > does not seem to have any meaning for plot. > > It is clearly useful to have such a capability. > I use it to make heat maps, for instance. > See heatmaps.dem But that just goes to my point: the examples in heatmaps.dem all use splot (not plot), except for one that uses "with image", which I think is for a binary file (not ascii). I still can't see any "proper" use for an ASCII matrix with plot (not splot). > But whether I use it in the way orginally intended is another > question :-) > > > Another bizarre property is that the following command can be > used to plot the values in a row of data rather than a column > of data, which is otherwise "impossible" in a normal gnuplot command: > > plot 'rowdata' matrix using 1:0 > > I suspect this was totally unintended. At one point I tried > to figure out if this was generalizable, but I got too confused > and gave it up. I admit, that is cute. |
|
From: Ethan M. <merritt@u.washington.edu> - 2009-11-22 06:48:14
|
On Saturday 21 November 2009, Philipp K. Janert wrote: > On Saturday 21 November 2009 07:54:55 pm you wrote: > > > > > > For plot (not splot), I am completely confused. Does > > > it even make sense to have the notion of a "matrix" > > > format for plot? The "matrix" keyword seems to suggest > > > that the data is on a regular, 2-dim grid. This notion > > > does not seem to have any meaning for plot. > > > > It is clearly useful to have such a capability. > > I use it to make heat maps, for instance. > > See heatmaps.dem > > But that just goes to my point: the examples in > heatmaps.dem all use splot (not plot), except > for one that uses "with image", which I think is > for a binary file (not ascii). The one in the demo is in-line ascii data. But hmm, you're right that it doesn't include the 'matrix' keyword. Oh... I see. That's the wrong demo. I was thinking of the heatmaps in imageNaN.dem, which are drawn like this: plot '-' matrix with image failsafe 0 5 4 3 1 0 ? 2 2 0 0 1 Junk 1 2 3 4 5 NaN 0 0 3 1 0 Inf 3 2 0 2 3 -Inf 0 1 2 4 3 e e > I still can't see any "proper" use for an ASCII > matrix with plot (not splot). The end result I was aiming for when last I looked at this was to generate heatmaps directly from a csv file (e.g. from excel), where the row and column categories had headers. I'll draw this here as in-line data with whitespace. The command below doesn't work, of course, but I was trying to understand the whole matrix mechanism well enough to see if I could tweak things to make it work: plot "-" matrix using xticlabels(0):yticlabels(0) with image xx A B C X 0 2 1 Y 2 0 1 Z 1 1 2 I forget now why I wanted it to be a 'plot' command rather than 'splot'. Maybe because of the limited control over tic label placement in 3D. Or maybe because the code at first looked slightly less confusing. EAM |
|
From: Philipp K. J. <ja...@ie...> - 2009-11-22 08:33:26
|
[snip] > The end result I was aiming for when last I looked at this was > to generate heatmaps directly from a csv file (e.g. from excel), > where the row and column categories had headers. I'll draw this > here as in-line data with whitespace. The command below doesn't > work, of course, but I was trying to understand the whole matrix > mechanism well enough to see if I could tweak things to make it work: > > plot "-" matrix using xticlabels(0):yticlabels(0) with image > xx A B C > X 0 2 1 > Y 2 0 1 > Z 1 1 2 > > I forget now why I wanted it to be a 'plot' command rather than 'splot'. > Maybe because of the limited control over tic label placement in 3D. > Or maybe because the code at first looked slightly less confusing. That seems to go back to my point - this kind of graph is exactly what I always thought the splot command specfically was for. So, if anything, I would think it makes sense to beef up splot (ticmarks, whatever), rather than overload plot with redundant functionality. (?) |
|
From: Daniel J S. <dan...@ie...> - 2009-11-22 10:04:07
|
Hi Philipp, The interpretation of matrix can vary depending on the item being plotted. First, "matrix" by itself is a legacy keyword that is still accepted for backward compatibility. It's gnuplot's matrix format, who's definition is given in the documentation. Images are the plot elements that makes sense in a matrix format for "plot". Color can be five dimensional, alpha-channel six dimensional. You asked about the legality of some syntax. The answer is maybe yes, maybe no. It depends on whether it makes sense for the elements being plotted. In some circumstances there are default column definitions. It's still open for discussion. Dan Philipp K. Janert wrote: > I am not sure how the "matrix" keyword works > (that is: is supposed to work) when used together > with the plot (not splot) command. > > Can you help me to enumerate the legal uses? > > For splot, there seem to be two legal ways to use > matrix: > > splot "file" matrix > and > splot "file" matrix u ($1):($2):3 > > The first assumes the values in the file to be z-values > on a regular grid. > > The second assumes that the z-values are in "column" > 3, and allows me to fix the x- and y-coordinates through > the "columns" 1 and 2. > > Is it legal to do either: > > splot "file" matrix u 1 > or > splot "file" matrix 1:2 > > And if so, what do either of them do? > > For plot (not splot), I am completely confused. Does > it even make sense to have the notion of a "matrix" > format for plot? The "matrix" keyword seems to suggest > that the data is on a regular, 2-dim grid. This notion > does not seem to have any meaning for plot. > > Best, > > Ph. > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > 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://www(DOT)dansebald(DOT)com |
|
From: Philipp K. J. <ja...@ie...> - 2009-11-22 06:21:19
|
On Saturday 21 November 2009 07:15:43 pm Daniel J Sebald wrote: > Hi Philipp, > > The interpretation of matrix can vary depending on the item being plotted. > > First, "matrix" by itself is a legacy keyword that is still accepted for > backward compatibility. It's gnuplot's matrix format, who's definition is > given in the documentation. Huh? What has replaced it, then? > > Images are the plot elements that makes sense in a matrix format for > "plot". Color can be five dimensional, alpha-channel six dimensional. But that assumes a binary file, always, doesn't it? > > You asked about the legality of some syntax. The answer is maybe yes, > maybe no. It depends on whether it makes sense for the elements being > plotted. In some circumstances there are default column definitions. It's > still open for discussion. > > Dan > > Philipp K. Janert wrote: > > I am not sure how the "matrix" keyword works > > (that is: is supposed to work) when used together > > with the plot (not splot) command. > > > > Can you help me to enumerate the legal uses? > > > > For splot, there seem to be two legal ways to use > > matrix: > > > > splot "file" matrix > > and > > splot "file" matrix u ($1):($2):3 > > > > The first assumes the values in the file to be z-values > > on a regular grid. > > > > The second assumes that the z-values are in "column" > > 3, and allows me to fix the x- and y-coordinates through > > the "columns" 1 and 2. > > > > Is it legal to do either: > > > > splot "file" matrix u 1 > > or > > splot "file" matrix 1:2 > > > > And if so, what do either of them do? > > > > For plot (not splot), I am completely confused. Does > > it even make sense to have the notion of a "matrix" > > format for plot? The "matrix" keyword seems to suggest > > that the data is on a regular, 2-dim grid. This notion > > does not seem to have any meaning for plot. > > > > Best, > > > > Ph. > > > > ------------------------------------------------------------------------- > >----- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > > 30-Day trial. Simplify your report design, integration and deployment - > > and focus on what you do best, core application coding. Discover what's > > new with Crystal Reports now. http://p.sf.net/sfu/bobj-july > > _______________________________________________ > > gnuplot-beta mailing list > > gnu...@li... > > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta |
|
From: Benjamin L. <lin...@gm...> - 2009-11-22 10:35:12
|
Philipp K. Janert wrote: >> Images are the plot elements that makes sense in a matrix format for >> "plot". Color can be five dimensional, alpha-channel six dimensional. > > But that assumes a binary file, always, doesn't it? No, there is ascii matrix and binary matrix. Where "binary matrix" has a very special meaning as it indicates a specific binary file format. Ascii matrix, however, is more what you'd expect, stating simply that the data is in a x/y grid, i.e. matrix form. This is an extremely useful format for plotting images where the height is coded as color. e.g. plot "-" matrix with image 1 0 0 0 1 0 0 0 1 e e benjamin |
|
From: Benjamin L. <lin...@gm...> - 2009-11-22 10:44:11
|
Philipp K. Janert wrote: > [snip] > >> The end result I was aiming for when last I looked at this was >> to generate heatmaps directly from a csv file (e.g. from excel), >> where the row and column categories had headers. I'll draw this >> here as in-line data with whitespace. The command below doesn't >> work, of course, but I was trying to understand the whole matrix >> mechanism well enough to see if I could tweak things to make it work: >> >> plot "-" matrix using xticlabels(0):yticlabels(0) with image >> xx A B C >> X 0 2 1 >> Y 2 0 1 >> Z 1 1 2 >> >> I forget now why I wanted it to be a 'plot' command rather than 'splot'. >> Maybe because of the limited control over tic label placement in 3D. >> Or maybe because the code at first looked slightly less confusing. > > That seems to go back to my point - this kind of graph > is exactly what I always thought the splot command > specfically was for. I don't quite agree here. Plotting an image in a x/y grid is still a 2D plot. Hence it makes sense (to me at least) to use "plot" rather than "splot". You can do a pm3d map plot and use "splot" to get a seemlingly equal result, but this is 1) orders of magnitude less efficient, since splot with pm2d draws every single polygon, whereas "plot with image" simply creates an image map (try this with a 500x500 image) 2) it's not the same result since pm3d calculates the height as mean/min/max/etc of the 4 corner heights. Compare the output of plot "-" matrix with image 1 0 0 0 1 0 0 0 1 e e with set pm3d map splot "-" matrix with pm3d 1 0 0 0 1 0 0 0 1 e e > So, if anything, I would think it makes sense to beef up > splot (ticmarks, whatever), rather than overload plot > with redundant functionality. (?) It's not redundant, in my opinion. Take a look at the gnuplot manual in section plotting style/image. It comments on the difference of "plot with image" and "splot with pm3d". benjamin |
|
From: Philipp K. J. <ja...@ie...> - 2009-11-22 15:41:52
|
Thanks, this is very helpful. I see now that "matrix" makes sense with "plot", but only with style "image". Is this correct? Are there legitimate uses for "matrix" with "plot", when using different styles? Also, can you give me a pointer to the manual section you were referring to at the very end of your email? I can't seem to find it. Best, Ph. On Sunday 22 November 2009 02:43:59 am you wrote: > Philipp K. Janert wrote: > > [snip] > > > >> The end result I was aiming for when last I looked at this was > >> to generate heatmaps directly from a csv file (e.g. from excel), > >> where the row and column categories had headers. I'll draw this > >> here as in-line data with whitespace. The command below doesn't > >> work, of course, but I was trying to understand the whole matrix > >> mechanism well enough to see if I could tweak things to make it work: > >> > >> plot "-" matrix using xticlabels(0):yticlabels(0) with image > >> xx A B C > >> X 0 2 1 > >> Y 2 0 1 > >> Z 1 1 2 > >> > >> I forget now why I wanted it to be a 'plot' command rather than 'splot'. > >> Maybe because of the limited control over tic label placement in 3D. > >> Or maybe because the code at first looked slightly less confusing. > > > > That seems to go back to my point - this kind of graph > > is exactly what I always thought the splot command > > specfically was for. > > I don't quite agree here. > Plotting an image in a x/y grid is still a 2D plot. > Hence it makes sense (to me at least) to use "plot" rather than "splot". > > You can do a pm3d map plot and use "splot" to get a seemlingly > equal result, but this is > 1) orders of magnitude less efficient, since splot with pm2d > draws every single polygon, whereas "plot with image" simply > creates an image map (try this with a 500x500 image) > 2) it's not the same result since pm3d calculates the > height as mean/min/max/etc of the 4 corner heights. > > > Compare the output of > > plot "-" matrix with image > 1 0 0 > 0 1 0 > 0 0 1 > e > e > > with > > set pm3d map > splot "-" matrix with pm3d > 1 0 0 > 0 1 0 > 0 0 1 > e > e > > > So, if anything, I would think it makes sense to beef up > > splot (ticmarks, whatever), rather than overload plot > > with redundant functionality. (?) > > It's not redundant, in my opinion. > Take a look at the gnuplot manual in section plotting style/image. > It comments on the difference of "plot with image" and "splot with pm3d". > > benjamin |
|
From: Ethan M. <merritt@u.washington.edu> - 2009-11-22 19:08:16
|
On Sunday 22 November 2009, Philipp K. Janert wrote:
>
> Thanks, this is very helpful.
>
> I see now that "matrix" makes sense with "plot",
> but only with style "image". Is this correct? Are
> there legitimate uses for "matrix" with "plot", when
> using different styles?
I don't have a real-life example plot to show, but it seems
plausible to me there is a use for superimposing additional
layers of information on top of a heat map.
Suppose that I have two matrices
A: generally non-zero value A(x,y) to be shown as a heat map
B: B(x,y) = 0 except for a small number of special cases.
These I want to show as circles or labels or something.
Then this would draw a heat map with labels on the interesting
points:
plot 'A' matrix with image, 'B' matrix using (something) with labels
... but it doesn't. It produces the error
Plot style does not conform to three column data in this graph mode
I think we're back to the confusion about what 'using' means in this context.
> Also, can you give me a pointer to the manual
> section you were referring to at the very end of
> your email? I can't seem to find it.
Perhaps the section below (page 48 in the pdf manual built for 4.4.rc1)?
II. Plot styles
35. Image
This reminds me that the set of pdf manuals on the web site
should be updated in parallel with the release of 4.4.
Anyone want to help with that?
|
|
From: Ethan M. <merritt@u.washington.edu> - 2009-11-22 19:41:25
|
> Then this would draw a heat map with labels on the interesting
> points:
>
> plot 'A' matrix with image, 'B' matrix using (something) with labels
>
> ... but it doesn't. It produces the error
> Plot style does not conform to three column data in this graph mode
> I think we're back to the confusion about what 'using' means in this context.
This much does work:
plot 'A' matrix with image, 'B' matrix using 1:($3==0?NaN:$2) with points
Confusion:
plot 'A' matrix using 1:2:3 with image, 'B' matrix using 1:2:3 with labels
This prints "1" everywhere. Why "1"?
Where did the real matrix contents go? Are they in some other pseudo-column?
Worse:
plot 'B' matrix using 1:2:(strcol(3)) with labels
Segmentation fault
|
|
From: Ethan M. <merritt@u.washington.edu> - 2009-11-23 04:08:13
|
On Sunday 22 November 2009, Philipp K. Janert wrote: > Are there legitimate uses for "matrix" with "plot", when > using different [not image] styles? I have explored this question a bit more. points: Works fine. The numeric value in the matrix can be used to set the point size, or type, or color. This should be documented somewhere. labels: Can never work to read strings from the file without radically changing the way the data is read and stored. It would be possible to generate labels from a numeric value stored in the file. (Needs a patch, but it's a simple patch). Not sure whether that is sufficiently useful to allow "... matrix ... with labels". dots: Possible, but why would you want to? circles/boxes/etc: You can't pass enough information in the single value to make these useful. lines: I already mentioned one cute possible use, but I don't know if that is sufficient to allow "... matrix ... with lines". There may be additional opportunities here somewhere. |