[Scilab-users] Filled polygons from polylines

2021-04-07 Thread arctica1963
Hello,

I have script that reads a csv file containing the data and uses that to
calculate subsidence from well information. This all works fine, but it is
not the best way to display the result. Is it possible to take the polyline
output and generate filled polygons (similar to attached image)?

I am not sure how it is possible from the existing code to close the output
result used in the plot function to create a closed polygon. Essentially it
needs extra points otherwise you would just tie the end point and start
point of the polyline.

It would be good to get some other ideas and whether it is actually
possible. Original code was in Matlab and had all of the data within the
script, so I took that out and stored in a separate data file for ease of
use.

Thanks for any suggestions.

Lester

Backstrip_1D_v1.sce
  
A1-NC198.csv   
Backstrip_1D_filled-plot.jpg
  



--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-07 Thread CRETE Denis
Hello, 
The filled area is defined by 2 curves apparently; one is the top border and 
one is the lower border. Is it possible to construct a closed polygon using the 
points of both curves (something like C=[C1;C2] ) ?
HTH
Denis

-Message d'origine-
De : users  De la part de arctica1963
Envoyé : mercredi 7 avril 2021 09:26
À : users@lists.scilab.org
Objet : [Scilab-users] Filled polygons from polylines

Hello,

I have script that reads a csv file containing the data and uses that to 
calculate subsidence from well information. This all works fine, but it is not 
the best way to display the result. Is it possible to take the polyline output 
and generate filled polygons (similar to attached image)?

I am not sure how it is possible from the existing code to close the output 
result used in the plot function to create a closed polygon. Essentially it 
needs extra points otherwise you would just tie the end point and start point 
of the polyline.

It would be good to get some other ideas and whether it is actually possible. 
Original code was in Matlab and had all of the data within the script, so I 
took that out and stored in a separate data file for ease of use.

Thanks for any suggestions.

Lester

Backstrip_1D_v1.sce
<http://mailinglists.scilab.org/file/t495709/Backstrip_1D_v1.sce>
A1-NC198.csv <http://mailinglists.scilab.org/file/t495709/A1-NC198.csv>
Backstrip_1D_filled-plot.jpg
<http://mailinglists.scilab.org/file/t495709/Backstrip_1D_filled-plot.jpg>  



--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-07 Thread Antoine Monmayrant

Hello all,

I think I answered this question before on this mailing list...

Ah, yes I did:

http://mailinglists.scilab.org/Reg-Area-Between-two-curves-td3393261.html#a4026721

Get the source for "[h,epoly,ey1,ey2]=BetweenCurves(x,y1,y2,varargin)" 
in the thread.


Hope it helps,

Antoine

On 07/04/2021 10:57, CRETE Denis wrote:

Hello,
The filled area is defined by 2 curves apparently; one is the top border and 
one is the lower border. Is it possible to construct a closed polygon using the 
points of both curves (something like C=[C1;C2] ) ?
HTH
Denis

-Message d'origine-
De : users  De la part de arctica1963
Envoyé : mercredi 7 avril 2021 09:26
À : users@lists.scilab.org
Objet : [Scilab-users] Filled polygons from polylines

Hello,

I have script that reads a csv file containing the data and uses that to 
calculate subsidence from well information. This all works fine, but it is not 
the best way to display the result. Is it possible to take the polyline output 
and generate filled polygons (similar to attached image)?

I am not sure how it is possible from the existing code to close the output 
result used in the plot function to create a closed polygon. Essentially it 
needs extra points otherwise you would just tie the end point and start point 
of the polyline.

It would be good to get some other ideas and whether it is actually possible. 
Original code was in Matlab and had all of the data within the script, so I 
took that out and stored in a separate data file for ease of use.

Thanks for any suggestions.

Lester

Backstrip_1D_v1.sce
<http://mailinglists.scilab.org/file/t495709/Backstrip_1D_v1.sce>
A1-NC198.csv <http://mailinglists.scilab.org/file/t495709/A1-NC198.csv>
Backstrip_1D_filled-plot.jpg
<http://mailinglists.scilab.org/file/t495709/Backstrip_1D_filled-plot.jpg>



--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-07 Thread CRETE Denis
Hello, I did not look carefully at the function "BetweenCurves", but it 
requires y1 and y2 to share the same x data. Isn't it a limitation ? Would it 
be useful to extend it to the case where x1 and x2 are not identical ?
Best regards
Denis
-Message d'origine-
De : users  De la part de Antoine Monmayrant
Envoyé : mercredi 7 avril 2021 11:16
À : users@lists.scilab.org
Objet : Re: [Scilab-users] Filled polygons from polylines

Hello all,

I think I answered this question before on this mailing list...

Ah, yes I did:

http://mailinglists.scilab.org/Reg-Area-Between-two-curves-td3393261.html#a4026721

Get the source for "[h,epoly,ey1,ey2]=BetweenCurves(x,y1,y2,varargin)" 
in the thread.

Hope it helps,

Antoine

On 07/04/2021 10:57, CRETE Denis wrote:
> Hello,
> The filled area is defined by 2 curves apparently; one is the top border and 
> one is the lower border. Is it possible to construct a closed polygon using 
> the points of both curves (something like C=[C1;C2] ) ?
> HTH
> Denis
>
> -Message d'origine-
> De : users  De la part de arctica1963 
> Envoyé : mercredi 7 avril 2021 09:26 À : users@lists.scilab.org Objet 
> : [Scilab-users] Filled polygons from polylines
>
> Hello,
>
> I have script that reads a csv file containing the data and uses that to 
> calculate subsidence from well information. This all works fine, but it is 
> not the best way to display the result. Is it possible to take the polyline 
> output and generate filled polygons (similar to attached image)?
>
> I am not sure how it is possible from the existing code to close the output 
> result used in the plot function to create a closed polygon. Essentially it 
> needs extra points otherwise you would just tie the end point and start point 
> of the polyline.
>
> It would be good to get some other ideas and whether it is actually possible. 
> Original code was in Matlab and had all of the data within the script, so I 
> took that out and stored in a separate data file for ease of use.
>
> Thanks for any suggestions.
>
> Lester
>
> Backstrip_1D_v1.sce
> <http://mailinglists.scilab.org/file/t495709/Backstrip_1D_v1.sce>
> A1-NC198.csv 
> <http://mailinglists.scilab.org/file/t495709/A1-NC198.csv>
> Backstrip_1D_filled-plot.jpg
> <http://mailinglists.scilab.org/file/t495709/Backstrip_1D_filled-plot.
> jpg>
>
>
>
> --
> Sent from: 
> http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f26
> 02246.html ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-07 Thread arctica1963
Hello Antoine,

Your code does seem to work since the x locations are constant for each
curve. However, I cannot see where exactly to apply the code for each layer
within my existing code and how to apply different fill colours.

This works to fill between the 2nd and 3rd polylines (see image):
[epoly,ey1,ey2]=BetweenCurves(-t,-xu(2,1:n),-xu(3,1:n)) // x=time,
y=subsidence

Sure it is something to do with the figure (f) and axes (a) handles.

Could you clarify where things go.

Many thanks

Lester

 



--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-07 Thread arctica1963
Think I spotted it...

figure(1), clf

f=gcf();
f.figure_size=[1024,800];
f.figure_name = "Subsidence of the Kufrah Basin Well A1-NC198";
f.background=8 // white background


title ('Subsidence of the Kufrah Basin Well A1-NC198') // Figure title

subplot (2,1,1)

a=gca();
a.font_size=3

[f,epoly,ey1,ey2]=BetweenCurves(-t,-xu(2,1:n),-xu(3,1:n),'Handle',f,'axis',a,
'foreground', 12 ) // for each interval

plot (-t,-xu(2,1:n),'b-o',..
  -t,-xu(3,1:n),'b-o',..
  -t,-xu(4,1:n),'b-o',.. etc





--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-09 Thread Samuel Gougeon

Le 07/04/2021 à 09:25, arctica1963 a écrit :

Hello,

I have script that reads a csv file containing the data and uses that to
calculate subsidence from well information. This all works fine, but it is
not the best way to display the result. Is it possible to take the polyline
output and generate filled polygons (similar to attached image)?

I am not sure how it is possible from the existing code to close the output
result used in the plot function to create a closed polygon. Essentially it
needs extra points otherwise you would just tie the end point and start
point of the polyline.

It would be good to get some other ideas and whether it is actually
possible. Original code was in Matlab and had all of the data within the
script, so I took that out and stored in a separate data file for ease of
use.

Thanks for any suggestions.

Lester

Backstrip_1D_v1.sce

A1-NC198.csv 
Backstrip_1D_filled-plot.jpg




Here is a simple example:

y = rand(1,20);
y2 = rand(1,20)+1;
y3 = rand(1,20)+2;
clf, plot([0 y3 0])
plot([0 y2 0])
plot([0 y 0])
gca().children.children.fill_mode = "on";
gca().children.children.background = [color("grey30") ; color("grey50") 
; color("grey70")];


Samuel

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-09 Thread Samuel Gougeon

Or better, to avoid artfefacts on boundaries:

y  =  rand(1,20);
y2  =  rand(1,20)+1;
y3  =  rand(1,20)+2;
x  =  [1  1:20  20];
clf,  plot(x,  [0  y3  0])
plot(x,  [0  y2  0])
plot(x,  [0  y  0])
gca().children.children.fill_mode= "on"
gca().children.children.background= [color("grey30"); color("grey50") ; 
color("grey70")];



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-13 Thread arctica1963
Hi Samuel,

Thanks for the suggestion. I have not managed to get it working with the
existing code as it generates an invalid index error; not sure what is going
on. I tidied up the file for clarity.

Following your example,

plot(x, [0 y3 0]) would be plot(-t, [0 -xu(1,1:n) 0] ) in this code, but
this generates an invalid index. Not sure what is falling over?

I did note that some vertices close to the top border are coincident, which
could cause issues. Will keep working on the problem, but any pointers would
be helpful.

Cheers

Lester

Backstrip_1D_v2.sce
  Lester



--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-14 Thread arctica1963
Hi Samuel,

Sorted out the code and it works.Had to manually set the filled areas upper
time limit (t=97) (plot(-[97 t], [0 y1]) ). Set two graphic handles for
upper and lower plot. Just random colours to test!

Is there a way to do a loop over the curves to save multiple plots

Thanks

Lester

 

 

Backstrip_1D_v2filltest.sce
  



--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-14 Thread arctica1963
Truncated plot at t=97

 



--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-14 Thread Antoine Monmayrant

Hello Lester,

On 14/04/2021 12:17, arctica1963 wrote:

Is there a way to do a loop over the curves to save multiple plots

What do you want to do exactly?
Do you want to get several image files with only part of the lines or 
surfaces visible?


Because you can do that by playing with the "visible" field of the 
different curves in your graph...


Antoine

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-14 Thread arctica1963
Sorry, I did not make it clear.

Instead of the following which updates the existing graphic to generate the
final plot (y1 to y10);

plot(-[t(n) t], [0 y1])
plot(-[t(n) t], [0 y2])
plot(-[t(n) t], [0 y3])
plot(-[t(n) t], [0 y4])
plot(-[t(n) t], [0 y5])
plot(-[t(n) t], [0 y6])
plot(-[t(n) t], [0 y7])
plot(-[t(n) t], [0 y8])
plot(-[t(n) t], [0 y9])
plot(-[t(n) t], [0 y10])

Can a loop (y) be made to simplify the above for clarity as a single plot
command? Not a big issue but would be good to know.

Lester



--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-14 Thread Antoine Monmayrant



On 14/04/2021 14:21, arctica1963 wrote:

Sorry, I did not make it clear.

Instead of the following which updates the existing graphic to generate the
final plot (y1 to y10);

plot(-[t(n) t], [0 y1])
plot(-[t(n) t], [0 y2])
plot(-[t(n) t], [0 y3])
plot(-[t(n) t], [0 y4])
plot(-[t(n) t], [0 y5])
plot(-[t(n) t], [0 y6])
plot(-[t(n) t], [0 y7])
plot(-[t(n) t], [0 y8])
plot(-[t(n) t], [0 y9])
plot(-[t(n) t], [0 y10])

Can a loop (y) be made to simplify the above for clarity as a single plot
command? Not a big issue but would be good to know.


Sure:

plot(-[t(n) t], [[0 y1];[0 y2];[0 y3];[0 y4];[0 y5];[0 y6];[0 y7];[0 y8];[0 
y9];[0 y10]])

Antoine



Lester



--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Filled polygons from polylines

2021-04-14 Thread arctica1963
Many thanks Antoine

Lester



--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users