[Ex1 - Q4] Ajout

Co-authored-by: Dimitrijevic <hugo.dimitrijevic@etu.u-pec.fr>
This commit is contained in:
Lyanis SOUIDI 2023-05-18 19:13:24 +02:00
parent c11fd49c80
commit 2dd75f5933
Signed by: Lyanis SOUIDI
GPG Key ID: 251ADD56CFE6A854
4 changed files with 50 additions and 1 deletions

View File

@ -90,3 +90,21 @@ bar([densiteAfrique, densiteAmeriqueDuNord, densiteAmeriqueDuSud, densiteAsie, d
**Résultat :** **Résultat :**
![Densité de population par continent](resources/img/ex1-3.png) ![Densité de population par continent](resources/img/ex1-3.png)
## Question 4
> Représenter la répartition de la surface terrestre puis du nombre d'habitants par continent sous la forme de diagramme en camembert à l'aide de l'instruction `pie`.
**[Script Scilab](resources/scripts/ex1-4.sce) :**
```scilab
pie([surfaceAfrique, surfaceAmeriqueDuNord, surfaceAmeriqueDuSud, surfaceAsie, surfaceEurope, surfaceOceanie]);
pie([populationAfrique, populationAmeriqueDuNord, populationAmeriqueDuSud, populationAsie, populationEurope, populationOceanie]);
```
**Résultat :**
![Répartition de la surface terrestre](resources/img/ex1-4-1.png)
![Répartition de la population](resources/img/ex1-4-2.png)

BIN
resources/img/ex1-4-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
resources/img/ex1-4-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -0,0 +1,31 @@
data = csvRead("resources/data/data.csv");
surfaceAfrique = sum(data(1:57, 2)* 1000);
populationAfrique = sum(data(1:57, 3)* 1000000);
surfaceAmeriqueDuNord = sum(data(58:86, 2)* 1000);
populationAmeriqueDuNord = sum(data(58:86, 3)* 1000000);
surfaceAmeriqueDuSud = sum(data(87:99, 2)* 1000);
populationAmeriqueDuSud = sum(data(87:99, 3)* 1000000);
surfaceAsie = sum(data(100:150, 2)* 1000);
populationAsie = sum(data(100:150, 3)* 1000000);
surfaceEurope = sum(data(151:193, 2)* 1000);
populationEurope = sum(data(151:193, 3)* 1000000);
surfaceOceanie = sum(data(194:207, 2)* 1000);
populationOceanie = sum(data(194:207, 3)* 1000000);
pie([surfaceAfrique, surfaceAmeriqueDuNord, surfaceAmeriqueDuSud, surfaceAsie, surfaceEurope, surfaceOceanie]);
title("Répartition de la surface terrestre");
legend(["Afrique", "Amérique du Nord", "Amérique du Sud", "Asie", "Europe", "Océanie"], 'out_upper_right');
xs2png(0,"resources/img/ex1-4-1.png");
clf();
pie([populationAfrique, populationAmeriqueDuNord, populationAmeriqueDuSud, populationAsie, populationEurope, populationOceanie]);
title("Répartition de la population mondiale");
legend(["Afrique", "Amérique du Nord", "Amérique du Sud", "Asie", "Europe", "Océanie"], 'out_upper_right');
xs2png(0,"resources/img/ex1-4-2.png");