|
From: Dima K. <gn...@di...> - 2017-07-26 22:05:02
|
Hi.
I think the following is a bug? Maybe?
I'm using a bleeding edge build of gnuplot from
https://github.com/gnuplot/gnuplot/commit/ca59a14e94df23008200f34cdb7ea8bc017ad946
Plotting a matrix of numbers as points with varying colors works ok:
plot '-' matrix using 1:2:3 notitle with points pt 7 ps 2 palette
1 2 3
4 5 6
e
I get 6 points in a grid, with different colors. I would expect that
plotting the same thing 'with labels' should work too, but with printed
text instead of points
plot '-' matrix using 1:2:3 notitle with labels
1 2 3
4 5 6
e
I get the grid of printed text, but each "point" is "6" and not "1",
"2", ...
Bug?
|
|
From: sfeam <sf...@us...> - 2017-07-27 00:01:39
|
On Wednesday, 26 July 2017 14:49:07 Dima Kogan wrote: > Hi. > > I think the following is a bug? Maybe? > > I'm using a bleeding edge build of gnuplot from > > https://github.com/gnuplot/gnuplot/commit/ca59a14e94df23008200f34cdb7ea8bc017ad946 > > Plotting a matrix of numbers as points with varying colors works ok: > > plot '-' matrix using 1:2:3 notitle with points pt 7 ps 2 palette > 1 2 3 > 4 5 6 > e > > I get 6 points in a grid, with different colors. I would expect that > plotting the same thing 'with labels' should work too, but with printed > text instead of points > > plot '-' matrix using 1:2:3 notitle with labels > 1 2 3 > 4 5 6 > e > > I get the grid of printed text, but each "point" is "6" and not "1", > "2", ... > > Bug? "with labels" wants a string, not a number. This should work: plot '-' matrix using 1:2:(sprintf("%d",column(3))) with labels I have no idea why it prints "6" though. That's a mystery. Ethan |
|
From: Dima K. <gn...@di...> - 2017-07-27 00:26:15
|
sfeam <sf...@us...> writes:
> On Wednesday, 26 July 2017 14:49:07 Dima Kogan wrote:
>>
>> Plotting a matrix of numbers as points with varying colors works ok:
>>
>> plot '-' matrix using 1:2:3 notitle with points pt 7 ps 2 palette
>> 1 2 3
>> 4 5 6
>> e
>>
>> I get 6 points in a grid, with different colors. I would expect that
>> plotting the same thing 'with labels' should work too, but with printed
>> text instead of points
>>
>> plot '-' matrix using 1:2:3 notitle with labels
>> 1 2 3
>> 4 5 6
>> e
>>
>> I get the grid of printed text, but each "point" is "6" and not "1",
>> "2", ...
>>
>> Bug?
>
> "with labels" wants a string, not a number.
> This should work:
>
> plot '-' matrix using 1:2:(sprintf("%d",column(3))) with labels
>
> I have no idea why it prints "6" though. That's a mystery.
Hmmm. I can replace the 1,2,3 thing with aaa,bbb,ccc, and it still
prints the last one. And this works ok for non-matrix plots, so it
sounds like a misbehavior to me. I'll try to find the time to look
through the sources and fix it; hopefully.
|
|
From: sfeam <sf...@us...> - 2017-07-27 00:42:55
|
On Wednesday, 26 July 2017 17:26:05 Dima Kogan wrote:
> sfeam <sf...@us...> writes:
>
> > On Wednesday, 26 July 2017 14:49:07 Dima Kogan wrote:
> >>
> >> Plotting a matrix of numbers as points with varying colors works ok:
> >>
> >> plot '-' matrix using 1:2:3 notitle with points pt 7 ps 2 palette
> >> 1 2 3
> >> 4 5 6
> >> e
> >>
> >> I get 6 points in a grid, with different colors. I would expect that
> >> plotting the same thing 'with labels' should work too, but with printed
> >> text instead of points
> >>
> >> plot '-' matrix using 1:2:3 notitle with labels
> >> 1 2 3
> >> 4 5 6
> >> e
> >>
> >> I get the grid of printed text, but each "point" is "6" and not "1",
> >> "2", ...
> >>
> >> Bug?
> >
> > "with labels" wants a string, not a number.
> > This should work:
> >
> > plot '-' matrix using 1:2:(sprintf("%d",column(3))) with labels
> >
> > I have no idea why it prints "6" though. That's a mystery.
>
> Hmmm. I can replace the 1,2,3 thing with aaa,bbb,ccc, and it still
> prints the last one.
There is no provision for a matrix to hold anything but floating point
numbers, so I would not expect anything useful from trying to fill
one with aaa bbb ccc etc. (Unless maybe it interprets them as
hexidecimal constants?)
> And this works ok for non-matrix plots,
Sure. The limitation arises specifically from what can be read in as a matrix.
> so it sounds like a misbehavior to me.
Well, if you could store strings in the matrix then yes "with labels" should
print them. But so for you are limited to floats.
Do you see a need to read in a matrix of strings?
Ethan
|