help-octave
[Top][All Lists]
Advanced

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

Re: Transparent lines


From: Nicholas Jankowski
Subject: Re: Transparent lines
Date: Mon, 15 Mar 2021 13:17:24 -0400

> I would like to have the plot lines with some sort of translucency. In Matlab, I can then put
> p1.Color(4)=0.05
> to set the alpha channel to 5%

playing with this a bit myself, i was wondering what changed in p1.  it's an odd hack. checking the properties of p1 before changing Color(4):

>> get(p1)
    AlignVertexCenters: off
            Annotation: [1×1 matlab.graphics.eventdata.Annotation]
          BeingDeleted: off
            BusyAction: 'queue'
         ButtonDownFcn: ''
              Children: [0×0 GraphicsPlaceholder]
              Clipping: on
                 Color: [0 0.4470 0.7410]
             ColorMode: 'auto'
           ContextMenu: [0×0 GraphicsPlaceholder]
             CreateFcn: ''
       DataTipTemplate: [1×1 matlab.graphics.datatip.DataTipTemplate]
             DeleteFcn: ''
           DisplayName: ''
      HandleVisibility: 'on'
               HitTest: on
         Interruptible: on
              LineJoin: 'round'
             LineStyle: '-'
         LineStyleMode: 'auto'
             LineWidth: 0.5000
                Marker: 'none'
       MarkerEdgeColor: 'auto'
       MarkerFaceColor: 'none'
         MarkerIndices: [1×10000 uint64]
            MarkerMode: 'auto'
            MarkerSize: 6
                Parent: [1×1 Axes]
         PickableParts: 'visible'
              Selected: off
    SelectionHighlight: on
           SeriesIndex: 1
                   Tag: ''
                  Type: 'line'
              UserData: []
               Visible: on
                 XData: [1×10000 double]
             XDataMode: 'manual'
           XDataSource: ''
                 YData: [1×10000 double]
           YDataSource: ''
                 ZData: [1×0 double]
           ZDataSource: ''

>> p1.Color

ans =

         0    0.4470    0.7410


then 

>> p1.Color(4) = 0.05 

definitely changes the plot, but the object properties are unchanged:

>> p1.Color(4)=.05

p1 =

  Line with properties:

              Color: [0 0.4470 0.7410]
          LineStyle: '-'
          LineWidth: 0.5000
             Marker: 'none'
         MarkerSize: 6
    MarkerFaceColor: 'none'
              XData: [1×10000 double]
              YData: [1×10000 double]
              ZData: [1×0 double]
Show all properties

    AlignVertexCenters: off
            Annotation: [1×1 matlab.graphics.eventdata.Annotation]
          BeingDeleted: off
            BusyAction: 'queue'
         ButtonDownFcn: ''
              Children: [0×0 GraphicsPlaceholder]
              Clipping: on
                 Color: [0 0.4470 0.7410]
             ColorMode: 'manual'
           ContextMenu: [0×0 GraphicsPlaceholder]
             CreateFcn: ''
       DataTipTemplate: [1×1 matlab.graphics.datatip.DataTipTemplate]
             DeleteFcn: ''
           DisplayName: ''
      HandleVisibility: 'on'
               HitTest: on
         Interruptible: on
              LineJoin: 'round'
             LineStyle: '-'
         LineStyleMode: 'auto'
             LineWidth: 0.5000
                Marker: 'none'
       MarkerEdgeColor: 'auto'
       MarkerFaceColor: 'none'
         MarkerIndices: [1×10000 uint64]
            MarkerMode: 'auto'
            MarkerSize: 6
                Parent: [1×1 Axes]
         PickableParts: 'visible'
              Selected: off
    SelectionHighlight: on
           SeriesIndex: 1
                   Tag: ''
                  Type: 'line'
              UserData: []
               Visible: on
                 XData: [1×10000 double]
             XDataMode: 'manual'
           XDataSource: ''
                 YData: [1×10000 double]
           YDataSource: ''
                 ZData: [1×0 double]
           ZDataSource: ''

and checking on the transparency: 

>> p1.Color(4)
Index exceeds the number of array elements (3).

>> p1.Color(4) = 0.01
(changes image fine, same behavior)

I'm guessing they added some hack to catch the element 4 assignment and perform the transparency change without actually making it a 4 element color assignment. Odds are a similar 'catch the deviant assignment' hack would work if we had a way to apply transparency in our graphics toolkits.

reply via email to

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