octave-maintainers
[Top][All Lists]
Advanced

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

Re: more graphics changes.


From: David Bateman
Subject: Re: more graphics changes.
Date: Wed, 21 Mar 2007 15:23:03 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

John W. Eaton wrote:
> On 21-Mar-2007, David Bateman wrote:
>
> | Another issue I just noticed that
> | 
> | plot(cos([1:10]),"-*g;;")
> | 
> | Doesn't respect the line colors and plots them all as Red.... Is this a
> | bug or a missing feature?
>
> Color properties are RGB triples in the graphics object.  The line
> spec "-*g" is translated to a line type and RGB color.  Gnuplot 4.2
> can handle the color directly, but earlier versions of gnuplot only
> have a very limited number of line types with set colors so I did not
> see that it was worth trying to map a color of [0,1,0] to a (possibly
> terminal dependent) line type number to specify the color when that
> can't possibly work for more than about six or seven colors.  I think
> the solution is to use gnuplot 4.2.
>
> jwe
>
>   
Ok, then what about the attached patch to at least bring similar
behavior to what we previously had for the line colors for older
versions of gnuplot.

D.

-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

*** ./scripts/plot/__go_draw_axes__.m.orig57    2007-03-20 18:22:31.000000000 
+0100
--- ./scripts/plot/__go_draw_axes__.m   2007-03-21 15:20:21.633430028 +0100
***************
*** 355,364 ****
          else
            titlespec{data_idx} = strcat ("title \"", obj.keylabel, "\"");
          endif
!         style = do_linestyle_command (obj, data_idx, plot_stream);
          usingclause{data_idx} = "";
!         withclause{data_idx} = sprintf ("with %s linestyle %d",
!                                         style, data_idx);
          parametric(i) = true;
          if (! isempty (obj.zdata))
            nd = 3;
--- 355,369 ----
          else
            titlespec{data_idx} = strcat ("title \"", obj.keylabel, "\"");
          endif
!         [style, typ] = do_linestyle_command (obj, data_idx, plot_stream);
          usingclause{data_idx} = "";
!         if (! have_newer_gnuplot && typ != data_idx)
!           withclause{data_idx} = sprintf ("with %s linetype %d",
!                                           style, typ);
!         else
!           withclause{data_idx} = sprintf ("with %s linestyle %d",
!                                           style, data_idx);
!         endif
          parametric(i) = true;
          if (! isempty (obj.zdata))
            nd = 3;
***************
*** 479,485 ****
  
        case "surface"
          data_idx++;
!         style = do_linestyle_command (obj, data_idx, plot_stream);
          filespec{data_idx} = '-';
          if (isempty (obj.keylabel))
            titlespec{data_idx} = "title \"\"";
--- 484,490 ----
  
        case "surface"
          data_idx++;
!         [style, typ] = do_linestyle_command (obj, data_idx, plot_stream);
          filespec{data_idx} = '-';
          if (isempty (obj.keylabel))
            titlespec{data_idx} = "title \"\"";
***************
*** 487,494 ****
            titlespec{data_idx} = strcat ("title \"", obj.keylabel, "\"");
          endif
          usingclause{data_idx} = "";
!         withclause{data_idx} = sprintf ("with %s linestyle %d",
!                                         style, data_idx);
          parametric(i) = false;
          nd = 3;
          xdat = obj.xdata;
--- 492,504 ----
            titlespec{data_idx} = strcat ("title \"", obj.keylabel, "\"");
          endif
          usingclause{data_idx} = "";
!         if (! have_newer_gnuplot && typ != data_idx)
!           withclause{data_idx} = sprintf ("with %s linetype %d",
!                                           style, typ);
!         else
!           withclause{data_idx} = sprintf ("with %s linestyle %d",
!                                           style, data_idx);
!         endif
          parametric(i) = false;
          nd = 3;
          xdat = obj.xdata;
***************
*** 764,770 ****
  
  endfunction
  
! function style = do_linestyle_command (obj, idx, plot_stream)
  
    persistent have_newer_gnuplot ...
      = compare_versions (__gnuplot_version__ (), "4.0", ">");
--- 774,780 ----
  
  endfunction
  
! function [style, typ] = do_linestyle_command (obj, idx, plot_stream)
  
    persistent have_newer_gnuplot ...
      = compare_versions (__gnuplot_version__ (), "4.0", ">");
***************
*** 775,786 ****
    fprintf (plot_stream, "set style line %d", idx);
  
    found_style = false;
  
!   if (isfield (obj, "color") && have_newer_gnuplot)
      color = obj.color;
      if (isnumeric (color))
!       fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
!              round (255*color));
      endif
      found_style = true;
    endif
--- 785,819 ----
    fprintf (plot_stream, "set style line %d", idx);
  
    found_style = false;
+   typ = idx;
  
!   if (isfield (obj, "color"))
      color = obj.color;
      if (isnumeric (color))
!       if (have_newer_gnuplot)
!       fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
!                round (255*color));
!       else
!       if (isequal(color,[0,0,0]))
!         typ = -1;
!       elseif (isequal(color,[1,0,0]))
!         typ = 1;
!       elseif (isequal(color,[0,1,0]))
!         typ = 2;
!       elseif (isequal(color,[0,0,1]))
!         typ = 3;
!       elseif (isequal(color,[1,0,1]))
!         typ = 4;
!       elseif (isequal(color,[0,1,1]))
!         typ = 5;
!       elseif (isequal(color,[1,1,1]))
!         typ = 6;
!       elseif (isequal(color,[1,1,0]))
!         typ = 7;
!       else
!         typ = 1;
!       endif
!       endif
      endif
      found_style = true;
    endif

reply via email to

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