[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #48666] CLimMode/CDataMapping not quite functi
From: |
Dan Sebald |
Subject: |
[Octave-bug-tracker] [bug #48666] CLimMode/CDataMapping not quite functioning correctly |
Date: |
Mon, 1 Aug 2016 06:52:58 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0 |
URL:
<http://savannah.gnu.org/bugs/?48666>
Summary: CLimMode/CDataMapping not quite functioning
correctly
Project: GNU Octave
Submitted by: sebald
Submitted on: Mon 01 Aug 2016 06:52:56 AM GMT
Category: Plotting
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: GNU/Linux
_______________________________________________________
Details:
In fixing a color map bug in the gnuplot graphics toolkit, I've discovered
that more broadly color isn't scaling quite right. The pertinent variables
are
IMAGE/SURFACE/PATCH OBJECT
'cdata'
'cdatamapping' [ {direct} | scaled ]
AXES
'clim'
'climmode' [ {auto} | manual ]
FIGURE
'colormap'
If the axes climmode is "auto", then clim is computed from the min and max of
'cdata' of all the color objects in the axes for which 'cdatamapping' is value
'direct'. Here is an example which shows the bug:
clf;
colormap (jet (21));
img = 1 ./ hilb (11);
x = y = -5:5;
h = image (x, y, img);
hold on
h = image (x+15, y, img+30);
xlim([-8,23])
kids = get(gca,'Children')
get(kids(1),'cdatamapping')
get(kids(2),'cdatamapping')
get(gca,'clim')
get(gca,'climmode')
Notice that the second image is all maroon, i.e., the maximum value in the
color map. It appears that only the first object is being used to determine
the max and min values of cdata.
In bug report https://savannah.gnu.org/bugs/index.php?48664 I have placed a
patch for gnuplot that does a first pass through all the graphical objects to
get the min/max for all cdata. The resulting image that I believe is correct
is attached here as a PNG. Notice how the colors are now mapped across the
wider range. It actually makes things easier to program with the clim from
the first pass because then 'clim' needs little extra treatment when setting
the cbrange--it's already computed.
So, if you agree the above change for gnuplot is correct, the question becomes
whether it should be the more general graphics routines that first run through
all children looking for the proper clim. If so, then I can back out what
would otherwise be extraneous code in gnuplot toolkit (i.e., the portion near
the top of the file).
OK, second issue is that Qt toolkit doesn't appear to scale properly in the
following scenario
clf
demo('surf', 1)
kids = get(gca,'Children');
set(kids(1),'cdatamapping','scaled')
set(gca,'climmode','manual')
get(gca,'clim')
set(gca,'clim',[0 1]) # This is a bug, should still look the same because
'scaled'
Even though the 'climmode' is 'manual', the color for the surface (mostly
purple for the negative values, but bright for positive values) should still
be scaled to fit the 'clim' and look exactly the same as the original demo
because 'cdatamapping' is 'scaled'. Now continue with:
set(kids(1),'cdatamapping','direct')
get(gca,'clim')
but the plot should look like the previous example (mostly purple negative),
but instead it appears to be almost all purple. If one wants to understand
what I'm describing (pasting PNGs would just be confusing), apply the patch
from https://savannah.gnu.org/bugs/index.php?48664 and try the same example
for the gnuplot toolkit and contrast the 'qt' toolkit result.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Mon 01 Aug 2016 06:52:56 AM GMT Name:
gnuplot_cdatamapping_direct_bug48664.png Size: 6kB By: sebald
<http://savannah.gnu.org/bugs/download.php?file_id=38061>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?48666>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #48666] CLimMode/CDataMapping not quite functioning correctly,
Dan Sebald <=