|
From: theozh <th...@gm...> - 2015-04-01 07:11:57
|
Hi there, In a matrix plot with logarithmic colorbar scale it is clear that negative numbers cannot be displayed. set logscale cb set cbrange[1e-10:1e-4] set palette rgbformulae 7,5,15 plot "Matrix.dat" matrix with image Therefore, I would like to display the negative values as "missing values", i.e. invisible (white or transparent). However, it seems that gnuplot gives these negative datapoints the color of the maximum value instead of the minimum value or treating it as missing data. How can I achieve that? Thanks for any hints. Theo. |
|
From: BBands <bb...@gm...> - 2015-04-01 17:16:25
|
As far as i know, negative values are a show stopper when using log
scaling. A fellow by the name of John McGinley devised a hack to plot data
that spanned 0 on opposing log scales by skipping near zero values and
using a mirrored (inverted) scale for negative values, but for normal folks
negative values are not defined for log scales.
John
On Wed, Apr 1, 2015 at 12:11 AM, theozh <th...@gm...> wrote:
> Hi there,
>
> In a matrix plot with logarithmic colorbar scale it is clear that
> negative numbers cannot be displayed.
>
> set logscale cb
> set cbrange[1e-10:1e-4]
> set palette rgbformulae 7,5,15
> plot "Matrix.dat" matrix with image
>
> Therefore, I would like to display the negative values as "missing
> values", i.e. invisible (white or transparent).
> However, it seems that gnuplot gives these negative datapoints the color
> of the maximum value instead of the minimum value or treating it as
> missing data. How can I achieve that?
>
> Thanks for any hints. Theo.
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> gnuplot-info mailing list
> gnu...@li...
> Membership management via:
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>
--
John Bollinger
www.BollingerBands.com
|
|
From: theozh <th...@gm...> - 2015-04-01 19:22:20
|
Hi John, it is absolutely clear to me that negative values cannot be displayed in log scale. If I wanted them to be displayed I would use the absolute value abs(x). That should work for column data: plot "ColumnData.dat" u 1:(abs($2)) Actually, I couldn't tell how one could do abs(x) on matrix data??? Nevertheless, I want to *ignore* negative values. And I do not want to change all datafiles. Why is gnuplot displaying negative values in log scale as maximum value? Theo. |
|
From: BBands <bb...@gm...> - 2015-04-01 20:44:30
|
The ternary operator is your friend.
plot "ColumnData.dat" u 1:($2 < 0 ? NaN : $2)
John
On Wed, Apr 1, 2015 at 12:22 PM, theozh <th...@gm...> wrote:
> Hi John,
>
> it is absolutely clear to me that negative values cannot be displayed in
> log scale. If I wanted them to be displayed I would use the absolute
> value abs(x). That should work for column data:
> plot "ColumnData.dat" u 1:(abs($2))
>
> Actually, I couldn't tell how one could do abs(x) on matrix data???
>
> Nevertheless, I want to *ignore* negative values. And I do not want to
> change all datafiles.
> Why is gnuplot displaying negative values in log scale as maximum value?
>
> Theo.
>
|
|
From: BBands <bb...@gm...> - 2015-04-01 22:39:09
|
Actually that should be:
plot "ColumnData.dat" u 1:($2 > 0 ? $2 : NaN)
John
On Wed, Apr 1, 2015 at 1:44 PM, BBands <bb...@gm...> wrote:
> The ternary operator is your friend.
>
> plot "ColumnData.dat" u 1:($2 < 0 ? NaN : $2)
>
> John
>
>
|
|
From: theozh <th...@gm...> - 2015-04-02 09:19:46
|
That's ok for column data... But how do you do it with matrix data? Am 02.04.2015 um 00:38 schrieb BBands: > Actually that should be: > > plot "ColumnData.dat" u 1:($2 > 0 ? $2 : NaN) > > John > |
|
From: Ethan M. <eam...@gm...> - 2015-04-03 17:04:14
|
On Fri, Apr 3, 2015 at 3:48 AM, theozh <th...@gm...> wrote: >> Same way. http://gnuplot.sourceforge.net/docs_4.2/node333.html >> >> On Thu, Apr 2, 2015 at 2:19 AM, theozh <th...@gm... >> <mailto:th...@gm...>> wrote: >> >> That's ok for column data... >> But how do you do it with matrix data? > > This works if you have your matrix data in column form: > x1 y1 z1 > x2 y2 z2 > x3 y2 z3 > x4 y4 z4 > ... > > But how do you do operation if you have it in matrix form? > z11 z12 z13 z14 > z21 z22 z23 z24 > z31 z32 z33 z34 > z41 z42 z43 z44 plot $DATA matrix using 1:2:($3<0 ? NaN : $3) with image > To illustrate the strange observation > > If you have a file "Matrix1.dat" > 1 2 3 4 > 2 -3 4 5 > 3 4 -5 6 > 4 5 6 7 > > set palette rgbformulae 7,5,15 > set logscale cb > plot "Matrix1.dat" matrix with image "set logscale cb" has been buggy/inconsistent for a long time. Some fixes went into the code recently, but I am not convinced that it is working consistently even now. I suggest that if possible you re-work your plot so that it does not require log-scaling on the colorbar. Note that the trick shown above (resetting negative values to NaN) will cause the corresponding pixels of a "with image" plot to be omitted altogether - that is, the background color will show through. This is unrelated to the min or max values on the color bar. FWIW, the following seems to give a correct plot in gnuplot 5 although I think the log scaling is not useful in this case: ~~~~~~ $DATA << EOD 1e-8 2e-8 3e-8 4e-8 2e-8 -3e-8 4e-8 5e-8 3e-8 4e-8 -5e-8 6e-8 4e-8 5e-8 6e-8 7e-8 EOD set palette rgbformulae 7,5,15 set logscale cb set cbrange [1e-8:1e-7] plot $DATA matrix using 1:2:($3<0 ? NaN : $3) with image ~~~~~~ Ethan > > The negative values will be displayed with the minimum color, i.e. black > > > However, if you have a file "Matrix2.dat" > 1e-8 2e-8 3e-8 4e-8 > 2e-8 -3e-8 4e-8 5e-8 > 3e-8 4e-8 -5e-8 6e-8 > 4e-8 5e-8 6e-8 7e-8 > > set palette rgbformulae 7,5,15 > set logscale cb > plot "Matrix1.dat" matrix with image > > The negative values will be displayed with the maximum color, i.e. yellow. > > What is the reasoning behind that? > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info |
|
From: theozh <th...@gm...> - 2015-04-03 10:48:46
|
> Same way. http://gnuplot.sourceforge.net/docs_4.2/node333.html > > On Thu, Apr 2, 2015 at 2:19 AM, theozh <th...@gm... > <mailto:th...@gm...>> wrote: > > That's ok for column data... > But how do you do it with matrix data? This works if you have your matrix data in column form: x1 y1 z1 x2 y2 z2 x3 y2 z3 x4 y4 z4 ... But how do you do operation if you have it in matrix form? z11 z12 z13 z14 z21 z22 z23 z24 z31 z32 z33 z34 z41 z42 z43 z44 To illustrate the strange observation If you have a file "Matrix1.dat" 1 2 3 4 2 -3 4 5 3 4 -5 6 4 5 6 7 set palette rgbformulae 7,5,15 set logscale cb plot "Matrix1.dat" matrix with image The negative values will be displayed with the minimum color, i.e. black However, if you have a file "Matrix2.dat" 1e-8 2e-8 3e-8 4e-8 2e-8 -3e-8 4e-8 5e-8 3e-8 4e-8 -5e-8 6e-8 4e-8 5e-8 6e-8 7e-8 set palette rgbformulae 7,5,15 set logscale cb plot "Matrix1.dat" matrix with image The negative values will be displayed with the maximum color, i.e. yellow. What is the reasoning behind that? |
|
From: theozh <th...@gm...> - 2015-04-03 19:49:57
|
OK, thanks John and Ethan. This trick works. plot "Matrix2.dat" matrix using 1:2:($3<0 ? NaN : $3) with image > > "set logscale cb" has been buggy/inconsistent for a long time. > Some fixes went into the code recently, but I am not convinced > that it is working consistently even now. I suggest that if > possible you re-work your plot so that it does not require > log-scaling on the colorbar. > Good to know that "set logscale cb" is obviously still buggy... I do not have a choice. I want to diplay currents which are ranging e.g. from 1e-11 to 1e-6. How should I display this without logscale? |
|
From: Ethan A M. <eam...@gm...> - 2015-04-03 22:04:40
|
On Friday, 03 April 2015 09:49:48 PM theozh wrote: > OK, thanks John and Ethan. This trick works. > > plot "Matrix2.dat" matrix using 1:2:($3<0 ? NaN : $3) with image > > > > > "set logscale cb" has been buggy/inconsistent for a long time. > > Some fixes went into the code recently, but I am not convinced > > that it is working consistently even now. I suggest that if > > possible you re-work your plot so that it does not require > > log-scaling on the colorbar. > > > Good to know that "set logscale cb" is obviously still buggy... > > I do not have a choice. I want to diplay currents which are ranging e.g. > from 1e-11 to 1e-6. How should I display this without logscale? There's no problem with log-scaling the value being plotted, the issue is with the settings for the color bar itself. So... unset log cb set cbrange [*:*] noextend plot $DATA matrix using 1:2:(log($3)) with image Of course this is a different mapping of z value -> color than before. In principle you could also manually re-map the palette definition using set palette functions R(gray), G(gray), B(gray) [but I have not actually tested this] Ethan |
|
From: Ethan A M. <eam...@gm...> - 2015-04-03 22:59:08
|
On Friday, 03 April 2015 03:04:32 PM Ethan A Merritt wrote: > On Friday, 03 April 2015 09:49:48 PM theozh wrote: > > OK, thanks John and Ethan. This trick works. > > > > plot "Matrix2.dat" matrix using 1:2:($3<0 ? NaN : $3) with image > > > > > > > > "set logscale cb" has been buggy/inconsistent for a long time. > > > Some fixes went into the code recently, but I am not convinced > > > that it is working consistently even now. I suggest that if > > > possible you re-work your plot so that it does not require > > > log-scaling on the colorbar. > > > > > Good to know that "set logscale cb" is obviously still buggy... > > > > I do not have a choice. I want to diplay currents which are ranging e.g. > > from 1e-11 to 1e-6. How should I display this without logscale? > > There's no problem with log-scaling the value being plotted, > the issue is with the settings for the color bar itself. > So... > > unset log cb > set cbrange [*:*] noextend > plot $DATA matrix using 1:2:(log($3)) with image > > Of course this is a different mapping of z value -> color than before. Actually, I now see it's the same mapping. I had not realized that. Bug? Feature? FWIW I found the specific bug that fails to color negative values as NaN (background) when the cb axis is in log mode. So that will be fixed in the next patchlevel release of version 5. Ethan |
|
From: theozh <th...@gm...> - 2015-04-04 07:03:51
|
> > Actually, I now see it's the same mapping. I had not realized that. > Bug? Feature? > As a simple user I cannot tell whether this is a bug or a feature ;-). > FWIW I found the specific bug that fails to color negative > values as NaN (background) when the cb axis is in log mode. > So that will be fixed in the next patchlevel release of version 5. > Thanks a lot, Ethan, for fixing that in the next release. The workaround works for the time being... Theo. |