octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #38263] legend text color for gnuplot


From: Ben Abbott
Subject: [Octave-bug-tracker] [bug #38263] legend text color for gnuplot
Date: Tue, 05 Feb 2013 13:57:51 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/536.26.17 (KHTML, like Gecko) Version/6.0.2 Safari/536.26.17

URL:
  <http://savannah.gnu.org/bugs/?38263>

                 Summary: legend text color for gnuplot
                 Project: GNU Octave
            Submitted by: bpabbott
            Submitted on: Tue 05 Feb 2013 08:57:49 AM EST
                Category: Plotting with gnuplot
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Ben Abbott
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

Matlab allows the text for the legend's entries to be modified by changing the
color property of the legend's text objects.

plot (rand (3));
[hl, hc] = legend ({"first", "second", "third"})
[hl, hc] = legend ({"first", "second", "third"})
hl = -9.9382
hc =

  -14.280  -17.483  -15.525  -18.609  -16.223  -19.801
get (hc, "type")
ans = 
{
  [1,1] = text
  [2,1] = line
  [3,1] = text
  [4,1] = line
  [5,1] = text
  [6,1] = line
}


Since there isn't a reliable way for Octave to know the extents of the text
objects for the gnuplot toolkit, the Gnuplot "key" feature is used to render
the legend.  Gnuplot does not allow the text color of the entries to be
specified arbitrarily.  However, the current situation where the text is
always black may be improved upon.

The color of all text objects may be modified using the Gnuplot syntax below.


set key textcolor "#RRGGBB";


This form is already supported by changing the "textcolor" property of the
legend hggroup object.

Gnuplot also supports matching the color of the text labels to the graphic
objects, 


set key textcolor variable;


This feature may be included in Octave using a patch like below.


$ hg diff
diff --git a/scripts/plot/private/__go_draw_axes__.m
b/scripts/plot/private/__go_draw_axes__.m
--- a/scripts/plot/private/__go_draw_axes__.m
+++ b/scripts/plot/private/__go_draw_axes__.m
@@ -1591,7 +1591,13 @@
       else
         fontspec = "";
       endif
-      colorspec = get_text_colorspec (hlgnd.textcolor, mono);
+      textcolors = cell2mat (get(findobj (hlgnd.children, "type", "text"),
"color"));
+      textcolors = unique (textcolors, "rows");
+      if (rows (textcolors) > 1)
+        colorspec = "textcolor variable";
+      else
+        colorspec = get_text_colorspec (textcolors, mono);
+      endif
       fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s %s;\n",
                inout, pos, box, reverse, horzvert, fontspec, colorspec);
     else


The "set key textcolor variable" syntax may not be consistent across all
versions of Gnuplot. This needs to be checked before committing.  If necessary
the __gnuplot_has_feature__.m function may need to be modified as well.






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?38263>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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