[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48427] legend objects in gnuplot

From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #48427] legend objects in gnuplot
Date: Thu, 7 Jul 2016 08:14:32 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0

Follow-up Comment #7, bug #48427 (project octave):

OK, I see the problems you mention and maybe one or two more.  Let me address
these one at a time.  First, I tried to add the patch to the key for the
surface demo.  Conceptually, I have it working (by placing a bogus entry into
the plot list that has the proper color and title) but I don't know where the
color to use for the patch is coming from.  It might be that the opengl
toolkits are choosing some color at random.

Well, given the surface handle, we can search through the legend group for a
match in the "userdata".  For each entry there is a "text" type and a
"patch"/"line" type.  I'm expecting that patch or line to have the proper
color that should appear in the legend.  But it doesn't have a proper color
for a surface.  Let's compare:

>> demo ('area', 1);
area example 1:
 ## Verify identity sin^2 + cos^2 = 1
 t = linspace (0, 2*pi, 100)';
 y = [sin(t).^2, cos(t).^2];
 area (t, y);
 axis tight
 legend ('sin^2', 'cos^2', 'location', 'NorthEastOutside');
 title ('area() plot');

>> kids = get(gcf, 'children');
>> grandkids = get(kids(1), 'children');
>> get(grandkids(1),"type")
ans = patch
>> get(grandkids(1),"facecolor")
ans =

   0.00000   0.50000   0.00000

>> demo("legend", 18);
legend example 18:
 colormap (cool (64));
 surf (peaks ());
 legend ('peaks()');
 title ('legend() works for surface objects too');

>> kids = get(gcf, 'children');
>> grandkids = get(kids(1), 'children');
>> get(grandkids(1),"facecolor")
ans = flat

What is shown in the above is that for the area demo there is a patch of dark
green to go along with presumably the dark green patch in the plot.  That
good.  But for the legend demo "peaks" the color that is given is "flat".  Is
that a valid color?  The "facelighting" property is also "flat" and that makes
sense.  So, where is the color coming from in the 'qt' terminal?  Is it just
picking the first entry in the palette?  The entry associated with zero?

In any case, it seems to me that the legend entry should have a valid color
that the user can see and set.

Now, if I continue with that peaks example and set the color of that legend
entry manually, it works:


No surprise, I guess.  It's just that Octave should fill in that proper
initial color, I think.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]