Re: About legend instruction in graphics -

classic Classic list List threaded Threaded
14 messages Options
Perrichon Perrichon
Reply | Threaded
Open this post in threaded view
|

Re: About legend instruction in graphics -

Hello,

 

Samuel’s « legends_mc » is a very nice instruction.

It does exactly what  I wanted

 

               xLeg=0.;

               yLeg=1.04;

 

                                                           Xlegend=["CVitesse";"Vitesse";"Vannage";"Débit";"Chute";"Puissance"]                                                           

                                                           legends_mc(Xlegend, Lpc=-10, framed?=%f, pos=[xLeg yLeg])

 

 

Other case

                                                           Xlegend=["Cons.Vitesse";'Vitesse filtrée';"Dérivée";"Intégrale";"Lim. Ouverture";"Cons. Vannage CVA";"Cons. charge CC"]                             

                                                           legends_mc(Xlegend, Lpc=2, framed?=%f, pos=[xLeg yLeg])

 

 :

 

 

Best regard

 

Pierre P.

De : users <[hidden email]> De la part de Samuel Gougeon
Envoyé : mercredi 8 janvier 2020 20:13
À : [hidden email]
Objet : Re: [Scilab-users] About legend instruction in graphics

 

Hello,

 

Le 08/01/2020 à 19:30, Perrichon a écrit :

 

Hello,

 

When drawing scope X(t) with multiple chanels, is there a way to get a horizontal legend to maximalize the graphic area (as matlab does)

All proposal for the legend positionning reduce the graphic area (vertical display with box or no box)

 

  1. Legend are into the graphic. Some curves are not visible
  2. Legend are out of graphic, but reduces the graphic area.

 

 

 

Best Regards

 

Pierre P.

 

 

 

--> legends_mc
function [] = legends_mc(Texts,Styles,Lpc,font_size,thickness,pos,framed?)
 For many curves & related legends, displays a multicolumn bloc of legends:
  - The shape of the bloc can be specified (Lpc)
  - Positionning with Logarithmic or/and reversed axes is supported
  - Lines styles and Markers styles are supported and can be mixed.
    A set of polyline handles or having polyline children can be
    alternatively provided
  - Lines thickness(es) can be specified (ignored if handles are
    given: read out from the polylines properties)

 HELP: run legends_mc() without any parameter
 DEMO: run legends_mc(..) without specifying Texts

 Texts  : vector of legends
 Styles : a) vector of related lines or markers styles (integer indices)
          Styles(i)>0 -> line color (only solid style supported)
          -14<= Styles(i) <=0 -> marker (overlay with line unsupported)
         b) (2,n) matrix:
             Styles(1,:) = as in a)
             Styles(2,:) = line style, or color of marker
         c) vector of graphical handles. Then all Polyline children
            are searched (in chronological order of creation).
            Texts must have as many entries as there are available
            polylines.
            If only 1 handle is given and is an axes, the legends is
            set in this axes. When returning, the focus is restored
            to the axes priorly active.
            If a set of handles or an handle not being an axes is given,
            the legends are set in the currently active axes.
         Default Styles : gca()
 Lpc>0 :  (maximal) number of Lines Per Column (integer)
 Lpc<0 : -(maximal) number of Columns per line (integer)
 framed? : boolean: if %T, draws the global box of legends (default)
 pos : position of the block:
      "ur" | 1 : in the upper right corner (default)
      "ul" | 2 : in the upper left corner
      "ll" | 3 : in the lower left corner
      "lr" | 4 : in the lower right corner
      "?"  | 5 : interactive positionning with the mouse
      [xr,yr]: relative coordinates 0 <= xr,yr <= 1 of the upper left
         corner of the block, with respect to the upper left corner
         of the data bounds area. [0,0] is equivalent to "ul"
 thickness: scalar or vector of lines thickness.
            If a vector is provided, its length must = Styles one.
            If styles are from handles, thickness vector is ignored.
 
 DEMOS: run legends_mc(..) without Texts of legends:
   clf, legends_mc( framed?=%f )
   clf, legends_mc( Lpc=7, pos="?" )
   clf, legends_mc( Lpc=-3, pos="lr" )
   clf, legends_mc( Lpc=-2, pos=[0.15 0.3] )
   clf, legends_mc( font_size=2, pos="ll" )
   clf, legends_mc( pos="?", thickness=2 )
   clf, legends_mc( pos="lr", thickness=1+round(rand(1:19)) )
   clf, plot2d(), legends_mc( Lpc=-3, pos="ll" )
   clf, plot(), f=gcf(); legends_mc(Styles=f.children($), pos="?")

 EXAMPLE:
   clf, plot2d(), legends_mc("line #"+string(1:3), Lpc=-3, pos="?" )


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
jean-philippe grivet jean-philippe grivet
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] density in a graph

Dear all,

I am drawing a graph in a gray scale (say from 1 to 32), using lines of
different density. I would like that, in the region of intersection of
two lines, the shade of gray be the sum of the densities of each line.
How can I manage that ?

Thanks in advance for any hint

JP Grivet


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Christophe Dang Ngoc Chan Christophe Dang Ngoc Chan
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} density in a graph

Hello,

> De : Jean-Philippe Grivet
> Envoyé : jeudi 23 janvier 2020 16:36
>
> I am drawing a graph in a gray scale (say from 1 to 32), using lines of different
> density. I would like that, in the region of intersection of two lines, the shade
> of gray be the sum of the densities of each line.
> How can I manage that ?

I'm affraid I can't figure out what you're trying to do.

Maybe a small drawing or a small sample of data?

Do you have lines with a linear density and try to draw a surface density or?

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

General
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
jean-philippe grivet jean-philippe grivet
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} density in a graph

Le 23/01/2020 à 17:24, Dang Ngoc Chan, Christophe a écrit :

> Hello,
>
>> De : Jean-Philippe Grivet
>> Envoyé : jeudi 23 janvier 2020 16:36
>>
>> I am drawing a graph in a gray scale (say from 1 to 32), using lines of different
>> density. I would like that, in the region of intersection of two lines, the shade
>> of gray be the sum of the densities of each line.
>> How can I manage that ?
> I'm affraid I can't figure out what you're trying to do.
>
> Maybe a small drawing or a small sample of data?
>
> Do you have lines with a linear density and try to draw a surface density or?
>
> --
> Christophe Dang Ngoc Chan
> Mechanical calculation engineer
>
> General
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users

Sorry that I haven't been clear enough. Suppose that I want to draw a
figure X made up of two strips. Strip 1 (SW_NE) has gray level 3; strip
2 (NW-SE) is drawn at gray level 7. The region of overlap of these
strips (roughly a parallelogram) should display a density of 7 (darker
than either strip). Is that possible within Scilab ?

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant-2 Antoine Monmayrant-2
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? density in a graph

In reply to this post by jean-philippe grivet
Hello Jean-Philippe,

I think I understand what you want to do, but there is no easy way to get this in scilab.
The main issue is that scilab does not support transparency.
Otherwise, you could just plot your lines in black with 1/32 alpha (or 255/32 alpha if 0 means transparent and 255 solid color).
For this kind of plot, I usually plot everything in scilab with a dummy color (let's say blue), export in svg, edit the svg to replace the dummy color by the transparent one.

Antoine
 
 
Le Jeudi, Janvier 23, 2020 16:35 CET, Jean-Philippe Grivet <[hidden email]> a écrit:
 

> Dear all,
>
> I am drawing a graph in a gray scale (say from 1 to 32), using lines of
> different density. I would like that, in the region of intersection of
> two lines, the shade of gray be the sum of the densities of each line.
> How can I manage that ?
>
> Thanks in advance for any hint
>
> JP Grivet
>
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} density in a graph

In reply to this post by jean-philippe grivet
Hi Jean-Philippe

To me it sounds like you are trying to fill a set of polygons in Scilab,
i.e. that what you wish to do can be done with xfpolys ...

https://help.scilab.org/docs/6.0.2/en_US/xfpolys.html

I doubt there is an automagic way to do it in Scilab. Probably it will
require some manual labor and or thinking up some function on your own. (?)

Best regards,
Claus

On 23.01.2020 17:50, Jean-Philippe Grivet wrote:

> Le 23/01/2020 à 17:24, Dang Ngoc Chan, Christophe a écrit :
>> Hello,
>>
>>> De : Jean-Philippe Grivet
>>> Envoyé : jeudi 23 janvier 2020 16:36
>>>
>>> I am drawing a graph in a gray scale (say from 1 to 32), using lines
>>> of different
>>> density. I would like that, in the region of intersection of two
>>> lines, the shade
>>> of gray be the sum of the densities of each line.
>>> How can I manage that ?
>> I'm affraid I can't figure out what you're trying to do.
>>
>> Maybe a small drawing or a small sample of data?
>>
>> Do you have lines with a linear density and try to draw a surface
>> density or?
>>
>> --
>> Christophe Dang Ngoc Chan
>> Mechanical calculation engineer
>>
>> General
>> This e-mail may contain confidential and/or privileged information.
>> If you are not the intended recipient (or have received this e-mail
>> in error), please notify the sender immediately and destroy this
>> e-mail. Any unauthorized copying, disclosure or distribution of the
>> material in this e-mail is strictly forbidden.
>> _______________________________________________
>> users mailing list
>> [hidden email]
>> http://lists.scilab.org/mailman/listinfo/users
>
> Sorry that I haven't been clear enough. Suppose that I want to draw a
> figure X made up of two strips. Strip 1 (SW_NE) has gray level 3;
> strip 2 (NW-SE) is drawn at gray level 7. The region of overlap of
> these strips (roughly a parallelogram) should display a density of 7
> (darker than either strip). Is that possible within Scilab ?
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
der_Phil der_Phil
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? density in a graph

In reply to this post by Antoine Monmayrant-2
something like this...only in gray?
test.png

Am Do., 23. Jan. 2020 um 19:08 Uhr schrieb Antoine Monmayrant <[hidden email]>:
Hello Jean-Philippe,

I think I understand what you want to do, but there is no easy way to get this in scilab.
The main issue is that scilab does not support transparency.
Otherwise, you could just plot your lines in black with 1/32 alpha (or 255/32 alpha if 0 means transparent and 255 solid color).
For this kind of plot, I usually plot everything in scilab with a dummy color (let's say blue), export in svg, edit the svg to replace the dummy color by the transparent one.

Antoine


Le Jeudi, Janvier 23, 2020 16:35 CET, Jean-Philippe Grivet <[hidden email]> a écrit:

> Dear all,
>
> I am drawing a graph in a gray scale (say from 1 to 32), using lines of
> different density. I would like that, in the region of intersection of
> two lines, the shade of gray be the sum of the densities of each line.
> How can I manage that ?
>
> Thanks in advance for any hint
>
> JP Grivet
>
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant-2 Antoine Monmayrant-2
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? ?==?utf-8?q? ?= density in a grap

That's what I understood, but using lines, not polygons.

Another approach than what I suggested previously would be to pixelate everything: ie make a big matrix for the whole graph and increment the value stored at a certain coordinate whenever it falls under one of the lines.
You could then plot this matrix using matplot of sgrayplot... with a graycolormap (maybe reversed graycolormap).
Far from ideal, but it would work.

Antoine
 
 
Le Jeudi, Janvier 23, 2020 21:27 CET, P M <[hidden email]> a écrit:
 

> something like this...only in gray?
> [image: test.png]
>
> Am Do., 23. Jan. 2020 um 19:08 Uhr schrieb Antoine Monmayrant <
> [hidden email]>:
>
> > Hello Jean-Philippe,
> >
> > I think I understand what you want to do, but there is no easy way to get
> > this in scilab.
> > The main issue is that scilab does not support transparency.
> > Otherwise, you could just plot your lines in black with 1/32 alpha (or
> > 255/32 alpha if 0 means transparent and 255 solid color).
> > For this kind of plot, I usually plot everything in scilab with a dummy
> > color (let's say blue), export in svg, edit the svg to replace the dummy
> > color by the transparent one.
> >
> > Antoine
> >
> >
> > Le Jeudi, Janvier 23, 2020 16:35 CET, Jean-Philippe Grivet <
> > [hidden email]> a écrit:
> >
> > > Dear all,
> > >
> > > I am drawing a graph in a gray scale (say from 1 to 32), using lines of
> > > different density. I would like that, in the region of intersection of
> > > two lines, the shade of gray be the sum of the densities of each line.
> > > How can I manage that ?
> > >
> > > Thanks in advance for any hint
> > >
> > > JP Grivet
> > >
> > >
> > > _______________________________________________
> > > users mailing list
> > > [hidden email]
> > > http://lists.scilab.org/mailman/listinfo/users
> > >
> >
> > _______________________________________________
> > users mailing list
> > [hidden email]
> > http://lists.scilab.org/mailman/listinfo/users
> >

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
jean-philippe grivet jean-philippe grivet
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? density in a graph

In reply to this post by Antoine Monmayrant-2
Le 23/01/2020 à 19:07, Antoine Monmayrant a écrit :

> Hello Jean-Philippe,
>
> I think I understand what you want to do, but there is no easy way to get this in scilab.
> The main issue is that scilab does not support transparency.
> Otherwise, you could just plot your lines in black with 1/32 alpha (or 255/32 alpha if 0 means transparent and 255 solid color).
> For this kind of plot, I usually plot everything in scilab with a dummy color (let's say blue), export in svg, edit the svg to replace the dummy color by the transparent one.
>
> Antoine
>  
>  
> Le Jeudi, Janvier 23, 2020 16:35 CET, Jean-Philippe Grivet <[hidden email]> a écrit:
>  
>> Dear all,
>>
>> I am drawing a graph in a gray scale (say from 1 to 32), using lines of
>> different density. I would like that, in the region of intersection of
>> two lines, the shade of gray be the sum of the densities of each line.
>> How can I manage that ?
>>
>> Thanks in advance for any hint
>>
>> JP Grivet
>>
>>
>> _______________________________________________
>> users mailing list
>> [hidden email]
>> http://lists.scilab.org/mailman/listinfo/users
>>
> _______________________________________________
> users mailing list
> [hidden email]

Thank you Antoine; I am not famo=iliar with the SVG format, but I will
investigate.

JP Grivet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
jean-philippe grivet jean-philippe grivet
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? density in a graph

In reply to this post by der_Phil
Le 23/01/2020 à 21:27, P M a écrit :
something like this...only in gray?
test.png

Am Do., 23. Jan. 2020 um 19:08 Uhr schrieb Antoine Monmayrant <[hidden email]>:
Hello Jean-Philippe,

I think I understand what you want to do, but there is no easy way to get this in scilab.
The main issue is that scilab does not support transparency.
Otherwise, you could just plot your lines in black with 1/32 alpha (or 255/32 alpha if 0 means transparent and 255 solid color).
For this kind of plot, I usually plot everything in scilab with a dummy color (let's say blue), export in svg, edit the svg to replace the dummy color by the transparent one.

Antoine


Le Jeudi, Janvier 23, 2020 16:35 CET, Jean-Philippe Grivet <[hidden email]> a écrit:

> Dear all,
>
> I am drawing a graph in a gray scale (say from 1 to 32), using lines of
> different density. I would like that, in the region of intersection of
> two lines, the shade of gray be the sum of the densities of each line.
> How can I manage that ?
>
> Thanks in advance for any hint
>
> JP Grivet
>
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

You understood perfectly, although my goal is simpler: instead of a blend of colors I look for a sum of densities.


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Christophe Dang Ngoc Chan Christophe Dang Ngoc Chan
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} Re: ?==?utf-8?q? density in a graph

In reply to this post by jean-philippe grivet
Hello,

> De : Jean-Philippe Grivet
> Envoyé : vendredi 24 janvier 2020 10:24
>
> Thank you Antoine; I am not famo=iliar with the SVG format, but I will
> investigate.

As you seem to understand French,
may I recommend you a small page of mine?

https://fr.wikibooks.org/wiki/D%C3%A9couvrir_le_SVG/Le_SVG_pour_l%27enseignement_des_math%C3%A9matiques_et_de_la_programmation

Hope this helps,

regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

General
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
jean-philippe grivet jean-philippe grivet
Reply | Threaded
Open this post in threaded view
|

Re: ?= density in a grap

In reply to this post by Antoine Monmayrant-2
Le 24/01/2020 à 08:45, Antoine Monmayrant a écrit :

> That's what I understood, but using lines, not polygons.
>
> Another approach than what I suggested previously would be to pixelate everything: ie make a big matrix for the whole graph and increment the value stored at a certain coordinate whenever it falls under one of the lines.
> You could then plot this matrix using matplot of sgrayplot... with a graycolormap (maybe reversed graycolormap).
> Far from ideal, but it would work.
>
> Antoine
>  
>  
> Le Jeudi, Janvier 23, 2020 21:27 CET, P M <[hidden email]> a écrit:
>  
>> something like this...only in gray?
>> [image: test.png]
>>
>> Am Do., 23. Jan. 2020 um 19:08 Uhr schrieb Antoine Monmayrant <
>> [hidden email]>:
>>
>>> Hello Jean-Philippe,
>>>
>>> I think I understand what you want to do, but there is no easy way to get
>>> this in scilab.
>>> The main issue is that scilab does not support transparency.
>>> Otherwise, you could just plot your lines in black with 1/32 alpha (or
>>> 255/32 alpha if 0 means transparent and 255 solid color).
>>> For this kind of plot, I usually plot everything in scilab with a dummy
>>> color (let's say blue), export in svg, edit the svg to replace the dummy
>>> color by the transparent one.
>>>
>>> Antoine
>>>
>>>
>>> Le Jeudi, Janvier 23, 2020 16:35 CET, Jean-Philippe Grivet <
>>> [hidden email]> a écrit:
>>>
>>>> Dear all,
>>>>
>>>> I am drawing a graph in a gray scale (say from 1 to 32), using lines of
>>>> different density. I would like that, in the region of intersection of
>>>> two lines, the shade of gray be the sum of the densities of each line.
>>>> How can I manage that ?
>>>>
>>>> Thanks in advance for any hint
>>>>
>>>> JP Grivet
>>>>
>>>>
>>>> _______________________________________________
>>>> users mailing list
>>>> [hidden email]
>>>> http://lists.scilab.org/mailman/listinfo/users
>>>>
>>> _______________________________________________
>>> users mailing list
>>> [hidden email]
>>> http://lists.scilab.org/mailman/listinfo/users
>>>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users

This approach looks rather easy to me. Have you a suggestion on how I
can define the pixels to be modified ?

Than you all for your suggestions

JP Grivet


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant-2 Antoine Monmayrant-2
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? ?==?utf-8?q? ?= density in a grap

Hello,

Well for the pixelated version, it needs a bit of coding that depends on the details of your specific case.
But here is a short example of the alternative method: generate an svg file and modify it afterwards to add opacity info.
The key idea is to set the color of the lines we want to set 1/2 transparent to something unique in the graph (like not white or black or some other color that are usually present in the axis) and later search the svg file for this specific color and add opacity.

Hope it helps,

Antoine

////////////////////////////////////////////////////////////////////////

cd('~');

// change here the color for any color that will be different from all other
// colors in the graph
colorStr="(10,10,10)"
opacity=0.3;//final opacity in the svg [0,1], 0 means transparent, 1 opaque

// the text that will appear in the generated svg and for each line
searchStr="stroke:rgb"+colorStr+";";
// we need to add the opacity info
replaceStr="stroke:"+colorStr+";stroke-opacity:"+string(opacity)+";";

// string to be executed after each plot of one of the line we want to be
//  1/2transparent
setLineStr="e=gce();e.children.thickness=10;e.children.foreground=color"+colorStr;

//dummy data
x=linspace(-1,1,10);

// the graph with overlapping lines
f=scf();
plot(x,x,'r')
execstr(setLineStr)

plot(x,-x,'b')
execstr(setLineStr)

plot(x,0.5*ones(x),'b')
execstr(setLineStr)


plot(x,-0.5*ones(x),'b')
execstr(setLineStr)

plot(0.5*ones(x),x,'b')
execstr(setLineStr)

plot(-0.5*ones(x),x,'b')
execstr(setLineStr)

xs2svg(f,"test.svg")

//read the generated svg file
fd = mopen('test.svg', 'rt')
svgTxt=mgetl(fd)
mclose(fd);

// add the transparency info
// can also alter all the line properties (color, width, ...)
newSvgTxt = strsubst(svgTxt, searchStr, replaceStr)

// write the new svg file with 1/2transparent lines
fd = mopen('test_transparency.svg', 'wt')
mputl(newSvgTxt,fd)
mclose(fd);

////////////////////////////////////////////////////////////////////////
 
 
Le Vendredi, Janvier 24, 2020 10:34 CET, Jean-Philippe Grivet <[hidden email]> a écrit:
 

> Le 24/01/2020 à 08:45, Antoine Monmayrant a écrit :
> > That's what I understood, but using lines, not polygons.
> >
> > Another approach than what I suggested previously would be to pixelate everything: ie make a big matrix for the whole graph and increment the value stored at a certain coordinate whenever it falls under one of the lines.
> > You could then plot this matrix using matplot of sgrayplot... with a graycolormap (maybe reversed graycolormap).
> > Far from ideal, but it would work.
> >
> > Antoine
> >  
> >  
> > Le Jeudi, Janvier 23, 2020 21:27 CET, P M <[hidden email]> a écrit:
> >  
> >> something like this...only in gray?
> >> [image: test.png]
> >>
> >> Am Do., 23. Jan. 2020 um 19:08 Uhr schrieb Antoine Monmayrant <
> >> [hidden email]>:
> >>
> >>> Hello Jean-Philippe,
> >>>
> >>> I think I understand what you want to do, but there is no easy way to get
> >>> this in scilab.
> >>> The main issue is that scilab does not support transparency.
> >>> Otherwise, you could just plot your lines in black with 1/32 alpha (or
> >>> 255/32 alpha if 0 means transparent and 255 solid color).
> >>> For this kind of plot, I usually plot everything in scilab with a dummy
> >>> color (let's say blue), export in svg, edit the svg to replace the dummy
> >>> color by the transparent one.
> >>>
> >>> Antoine
> >>>
> >>>
> >>> Le Jeudi, Janvier 23, 2020 16:35 CET, Jean-Philippe Grivet <
> >>> [hidden email]> a écrit:
> >>>
> >>>> Dear all,
> >>>>
> >>>> I am drawing a graph in a gray scale (say from 1 to 32), using lines of
> >>>> different density. I would like that, in the region of intersection of
> >>>> two lines, the shade of gray be the sum of the densities of each line.
> >>>> How can I manage that ?
> >>>>
> >>>> Thanks in advance for any hint
> >>>>
> >>>> JP Grivet
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> users mailing list
> >>>> [hidden email]
> >>>> http://lists.scilab.org/mailman/listinfo/users
> >>>>
> >>> _______________________________________________
> >>> users mailing list
> >>> [hidden email]
> >>> http://lists.scilab.org/mailman/listinfo/users
> >>>
> > _______________________________________________
> > users mailing list
> > [hidden email]
> > http://lists.scilab.org/mailman/listinfo/users
>
> This approach looks rather easy to me. Have you a suggestion on how I
> can define the pixels to be modified ?
>
> Than you all for your suggestions
>
> JP Grivet
>
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
jean-philippe grivet jean-philippe grivet
Reply | Threaded
Open this post in threaded view
|

Re: density in a graph

In reply to this post by Antoine Monmayrant-2
P M, Claus, Antoine, Christophe; Federico:

Thank you  all fior your multifaceted and interesting suggestions. A
special mention to Christophe: the pages on the SVG format are extremely
clear; in my opinion, they deserve a wide audience and should be
translated in English.

I now understand that I should have described my ultimate goal, even
though it is somewhat complicated.. My aim is to emulate image
reconstruction in X-ray tomography. In the simplest reconstruction
algorithm,  back projection, one must darken the image plane
proportional to the value  of  a "projection" of the object, for each
projection direction (at least 128 in all). These "darkenings"  must add
everywhere in the image plane. A sketch of this process is shown in the
attached figure.

I have found two other possible approaches. In thee book by Michel
Goossens et al (the Latex graphics companion) there appears (pp 257-258)
a Latex program that emulates transparency. To use this , I would have
to read into pstricks the coordinates of the various rectangles, which
seems possible. Moreover, I have read that PDF supports transparency,
though I have no idea how this fact could be exploited in Scilab.

I have quie a lot of home work to do! Thank you again for your help.

JP Grivet


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

scanner.pdf (25K) Download Attachment