Commit 6153aaa0 authored by Croce Loris's avatar Croce Loris
Browse files

change fig display

parent f22847c7
No related merge requests found
Showing with 3 additions and 12 deletions
+3 -12
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` ```
import numpy as np import numpy as np
import pandas as pd import pandas as pd
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` ```
hist = dict() hist = dict()
# effectives RPG plots Aura # effectives RPG plots Aura
# codes = np.sort(pd.unique(rpg.CODE_GROUP)) # codes = np.sort(pd.unique(rpg.CODE_GROUP))
# [hist[y][i] = len(rpg[rpg.CODE_GROUP.eq(i)]) for i in codes] # [hist[y][i] = len(rpg[rpg.CODE_GROUP.eq(i)]) for i in codes]
hist[2015] = {1: 81618, 2: 89981, 3: 33647, 4: 49168, 5: 10003, 6: 11182, 7: 4500, 8: 1918, 9: 61, 11: 27389, 15: 3349, 16: 32592, 17: 57463, 18: 597172, 19: 144620, 20: 18793, 21: 38169, 22: 12930, 23: 2469, 24: 8996, 25: 14732, 28: 78899} hist[2015] = {1: 81618, 2: 89981, 3: 33647, 4: 49168, 5: 10003, 6: 11182, 7: 4500, 8: 1918, 9: 61, 11: 27389, 15: 3349, 16: 32592, 17: 57463, 18: 597172, 19: 144620, 20: 18793, 21: 38169, 22: 12930, 23: 2469, 24: 8996, 25: 14732, 28: 78899}
hist[2016] = {1: 84240, 2: 80146, 3: 33804, 4: 50970, 5: 10161, 6: 8896, 7: 4930, 8: 2233, 9: 37, 11: 25166, 14: 1, 15: 3103, 16: 39669, 17: 54299, 18: 581945, 19: 142946, 20: 17936, 21: 38665, 22: 13251, 23: 2477, 24: 9743, 25: 14689, 28: 87832} hist[2016] = {1: 84240, 2: 80146, 3: 33804, 4: 50970, 5: 10161, 6: 8896, 7: 4930, 8: 2233, 9: 37, 11: 25166, 14: 1, 15: 3103, 16: 39669, 17: 54299, 18: 581945, 19: 142946, 20: 17936, 21: 38665, 22: 13251, 23: 2477, 24: 9743, 25: 14689, 28: 87832}
hist[2018] = {1: 75073, 2: 76775, 3: 31486, 4: 51058, 5: 13405, 6: 8968, 7: 5724, 8: 1765, 9: 63, 11: 26532, 14: 1, 15: 3881, 16: 48300, 17: 53667, 18: 643118, 19: 104729, 20: 17979, 21: 39459, 22: 13691, 23: 2472, 24: 10258, 25: 15159, 28: 92444} hist[2018] = {1: 75073, 2: 76775, 3: 31486, 4: 51058, 5: 13405, 6: 8968, 7: 5724, 8: 1765, 9: 63, 11: 26532, 14: 1, 15: 3881, 16: 48300, 17: 53667, 18: 643118, 19: 104729, 20: 17979, 21: 39459, 22: 13691, 23: 2472, 24: 10258, 25: 15159, 28: 92444}
hist[2019] = {1: 73869, 2: 78082, 3: 29671, 4: 53316, 5: 8627, 6: 9345, 7: 5039, 8: 1864, 9: 88, 11: 26034, 14: 1, 15: 3485, 16: 50010, 17: 52513, 18: 640818, 19: 109203, 20: 18348, 21: 40734, 22: 14190, 23: 2549, 24: 10760, 25: 15246, 28: 94843} hist[2019] = {1: 73869, 2: 78082, 3: 29671, 4: 53316, 5: 8627, 6: 9345, 7: 5039, 8: 1864, 9: 88, 11: 26034, 14: 1, 15: 3485, 16: 50010, 17: 52513, 18: 640818, 19: 109203, 20: 18348, 21: 40734, 22: 14190, 23: 2549, 24: 10760, 25: 15246, 28: 94843}
correspondances = {1: "BLE TENDRE", 2: "MAIS GRAIN ET ENSILAGE", 3: "ORGE", 4: "AUTRES CEREALES", 5: "COLZA", 6: "TOURNESOL", 7: "AUTRES OLEAGINEUX", 8: "PROTEAGINEUX", 9: "PLANTES A FIBRES", 10: "SEMENCES", 11: "GEL", 12: "GEL INDUSTRIEL", 13: "AUTRES GELS", 14: "RIZ", 15: "LEGUMINEUSES A GRAIN", 16: "FOURRAGE", 17: "ESTIVES LANDES", 18: "PRAIRIES PERMANENTES", 19: "PRAIRIES TEMPORAIRES", 20: "VERGERS", 21: "VIGNES", 22: "FRUITS A COQUES", 23: "OLIVIERS", 24: "AUTRES CULTURES INDUSTRIELLES", 25: "LEGUMES-FLEURS", 26: "CANNE A SUCRE", 27: "ARBORICULTURE", 28: "DIVERS"} correspondances = {1: "BLE TENDRE", 2: "MAIS GRAIN ET ENSILAGE", 3: "ORGE", 4: "AUTRES CEREALES", 5: "COLZA", 6: "TOURNESOL", 7: "AUTRES OLEAGINEUX", 8: "PROTEAGINEUX", 9: "PLANTES A FIBRES", 10: "SEMENCES", 11: "GEL", 12: "GEL INDUSTRIEL", 13: "AUTRES GELS", 14: "RIZ", 15: "LEGUMINEUSES A GRAIN", 16: "FOURRAGE", 17: "ESTIVES LANDES", 18: "PRAIRIES PERMANENTES", 19: "PRAIRIES TEMPORAIRES", 20: "VERGERS", 21: "VIGNES", 22: "FRUITS A COQUES", 23: "OLIVIERS", 24: "AUTRES CULTURES INDUSTRIELLES", 25: "LEGUMES-FLEURS", 26: "CANNE A SUCRE", 27: "ARBORICULTURE", 28: "DIVERS"}
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` ```
df = pd.DataFrame(columns=[i for i in range(1,29)]) df = pd.DataFrame(columns=[i for i in range(1,29)])
df.loc[2015] = hist[2015] df.loc[2015] = hist[2015]
df.loc[2016] = hist[2016] df.loc[2016] = hist[2016]
df.loc[2018] = hist[2018] df.loc[2018] = hist[2018]
df.loc[2019] = hist[2019] df.loc[2019] = hist[2019]
df["autre"] = df[[5,6,7,8,9,10,14,15,16,24,26,11,12,13,28,20,22,23,27,21,25]].sum(axis=1) df["autre"] = df[[5,6,7,8,9,10,14,15,16,24,26,11,12,13,28,20,22,23,27,21,25]].sum(axis=1)
df["elevage"] = df[[17,18,19]].sum(axis=1) df["elevage"] = df[[17,18,19]].sum(axis=1)
df["cereales"] = df[[1,2,3,4]].sum(axis=1) df["cereales"] = df[[1,2,3,4]].sum(axis=1)
df["total"] = df.sum(axis=1) df["total"] = df.sum(axis=1)
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` ```
for i in range(1,29): for i in range(1,29):
plt.scatter([2015,2016,2018,2019],df[i]) plt.scatter([2015,2016,2018,2019],df[i])
plt.plot([2015,2016,2018,2019],df[i]) plt.plot([2015,2016,2018,2019],df[i])
plt.xticks([2015,2016,2018,2019]) plt.xticks([2015,2016,2018,2019])
plt.title("Evolution culture " + correspondances[i] +" (" + str(i) + ") " + " RPG") plt.title("Evolution culture " + correspondances[i] +" (" + str(i) + ") " + " RPG")
plt.xlabel("années") plt.xlabel("années")
plt.ylabel("nombre de parcelles") plt.ylabel("nombre de parcelles")
plt.ticklabel_format(style='plain') plt.ticklabel_format(style='plain')
plt.savefig("fig/evol" + str(i) + ".png") plt.savefig("fig/evol" + str(i) + ".png")
plt.clf() plt.clf()
for i in ["autre", "elevage", "cereales", "total"]: for i in ["autre", "elevage", "cereales", "total"]:
plt.scatter([2015,2016,2018,2019],df[i]) plt.scatter([2015,2016,2018,2019],df[i])
plt.plot([2015,2016,2018,2019],df[i]) plt.plot([2015,2016,2018,2019],df[i])
plt.xticks([2015,2016,2018,2019]) plt.xticks([2015,2016,2018,2019])
plt.xlabel("années") plt.xlabel("années")
plt.ylabel("nombre de parcelles") plt.ylabel("nombre de parcelles")
plt.title("Evolution " + i + " RPG") plt.title("Evolution " + i + " RPG")
plt.ticklabel_format(style='plain') plt.ticklabel_format(style='plain')
plt.savefig("fig/evol_" + i + ".png") plt.savefig("fig/evol_" + i + ".png")
plt.clf() plt.clf()
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# RPG cultures evolution # RPG cultures evolution
All figures in [`fig/`](fig/) All figures in [`fig/`](fig/)
## Graphs ## Graphs
### Categories
| Breeding | Cereales | Autre |
|:-------------------------:|:--------------------------:|:-----------------------:|
| ![](fig/evol_elevage.png) | ![](fig/evol_cereales.png) | ![](fig/evol_autre.png) |
### Total
![](fig/evol_total.png)
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` ```
from IPython.display import display, Image from IPython.display import display, Image
display(Image(filename='fig/evol_total.png')) for i in ["elevage", "cereales", "autre", "total"]:
display(Image(filename='fig/evol_'+i+'.png'))
``` ```
%% Output %% Output
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment