octave-maintainers
[Top][All Lists]
Advanced

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

Re: Plotting semi-trasnparent patches?


From: Kai Habel
Subject: Re: Plotting semi-trasnparent patches?
Date: Thu, 29 Jan 2009 19:56:03 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Kai Habel schrieb:
> Soren Hauberg schrieb:
>   
>> Hi All
>>
>> Is there a way to make a patch (as produced by the 'patch' command)
>> semi-transparent? I tried setting the 'facealpha' property to 0.5 but
>> that didn't do what I expected.
>>
>> BTW. I'm running a checkout of the development sources from some time
>> yesterday.
>>
>> Soren
>>
>> _______________________________________________
>> Help-octave mailing list
>> address@hidden
>> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>>   
>>     
> Using a development version of gnuplot (4.3.cvs) this can be implemented
> fairly easy. See attached patch. I am hesitating in providing a full
> changeset, since we would depend on a development version of gnuplot. I
> see no easy way to check for this gnuplot feature otherwise we could
> support this conditionally. I think we have to wait for gnuplot release
> which supports this feature. 
>
> Kai
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Since Ben has pushed the __gnuplot_has_feature__() function, I have
slightly changed the changeset to enable transparent patches. After
applying the changeset and using gnuplot 4.3. you can test it with e.g.:

x = [0 1 1 0];y=[0 0 1 1];
patch(x,y,'red');
p=patch(x+0.5,y+0.5,'yellow');
for i=0:0.05:1,set(p,'facealpha',i);end

Kai
# HG changeset patch
# User Kai Habel
# Date 1233251665 -3600
# Node ID bfdb925cc83ebbe83fd3695168c1055ca0041e6e
# Parent  72635483abc5f682d7f27968c670f24e47ed59a9
Add support for transparent patches

diff -r 72635483abc5 -r bfdb925cc83e scripts/ChangeLog
--- a/scripts/ChangeLog Thu Jan 29 17:19:16 2009 +0100
+++ b/scripts/ChangeLog Thu Jan 29 18:54:25 2009 +0100
@@ -1,3 +1,7 @@
+2009-01-29  Kai Habel <address@hidden>
+
+        * plot/__go_draw_axes__.m: Add support for transparent patches
+
 2009-01-29  Kai Habel <address@hidden>
 
         * plot/Makefile.in: Add missing files to SOURCES
diff -r 72635483abc5 -r bfdb925cc83e scripts/plot/__go_draw_axes__.m
--- a/scripts/plot/__go_draw_axes__.m   Thu Jan 29 17:19:16 2009 +0100
+++ b/scripts/plot/__go_draw_axes__.m   Thu Jan 29 18:54:25 2009 +0100
@@ -567,6 +567,9 @@
 
               if (mono)
                 colorspec = "";
+               elseif (__gnuplot_has_feature__("transparent_patches") && 
isscalar (obj.facealpha))
+                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\" fillstyle 
transparent solid %f",
+                                     round (255*color), obj.facealpha);
               else
                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
                                      round (255*color));

reply via email to

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