<jupyter_start><jupyter_text>**Import library yang dibutuhkan**<jupyter_code>import numpy as np
%pip install scikit-fuzzy
import skfuzzy as fuzz
import matplotlib.pyplot as plt  
%matplotlib inline<jupyter_output>Requirement already satisfied: scikit-fuzzy in /usr/local/lib/python3.6/dist-packages (0.4.2)
Requirement already satisfied: numpy>=1.6.0 in /usr/local/lib/python3.6/dist-packages (from scikit-fuzzy) (1.19.5)
Requirement already satisfied: scipy>=0.9.0 in /usr/local/lib/python3.6/dist-packages (from scikit-fuzzy) (1.4.1)
Requirement already satisfied: networkx>=1.9.0 in /usr/local/lib/python3.6/dist-packages (from scikit-fuzzy) (2.5)
Requirement already satisfied: decorator>=4.3.0 in /usr/local/lib/python3.6/dist-packages (from networkx>=1.9.0->scikit-fuzzy) (4.4.2)<jupyter_text>**Definisikan atau atur koordinat untuk tiap variabel fuzzy**<jupyter_code>x_usia = np.arange(18, 58, 1)  
x_suhubadan = np.arange(27.5, 45.0, 1)  
x_kondnapas = np.arange(14, 24, 1)  
x_jmlantbd = np.arange(0.1, 8.0, 1)
x_status = np.arange(0, 100, 1)

usia_muda = fuzz.trapmf(x_usia,[18, 18, 30, 35])  
usia_pbaya = fuzz.trapmf(x_usia,[30, 36, 45, 50])  
usia_tua = fuzz.trapmf(x_usia,[45, 50, 58, 58])  
	  
suhu_hipo = fuzz.trapmf(x_suhubadan,[27.5, 27.5, 34.5, 35.5])  
suhu_normal = fuzz.trapmf(x_suhubadan,[34.5, 35.5, 36.5, 37.5])  
suhu_hiper = fuzz.trapmf(x_suhubadan,[36.5, 37.5, 45.0, 45.0])  

kondnapas_normal = fuzz.trapmf(x_kondnapas,[14, 14, 16, 17])  
kondnapas_moderat = fuzz.trapmf(x_kondnapas,[16, 18, 19, 20])  
kondnapas_abnormal = fuzz.trapmf(x_kondnapas,[19, 20, 24, 24])  

jmlantbd_normal = fuzz.trapmf(x_jmlantbd,[0.1, 0.1, 1.5, 2.0])  
jmlantbd_moderat = fuzz.trapmf(x_jmlantbd,[1.5, 2.1, 3.8, 4.0])  
jmlantbd_abnormal = fuzz.trapmf(x_jmlantbd,[3.8, 4.0, 8.0, 8.0])

status_negatif = fuzz.trapmf(x_status,[0, 0, 49, 50])
status_positif = fuzz.trapmf(x_status,[50, 51, 100, 100])<jupyter_output><empty_output><jupyter_text>**It's time to plotting!**<jupyter_code>fig, (ax0, ax1, ax2, ax3, ax4) = plt.subplots(nrows=5, figsize=(8, 10))

ax0.plot(x_usia, usia_muda, 'b', linewidth=1.5, label='Muda')  
ax0.plot(x_usia, usia_pbaya, 'g', linewidth=1.5, label='Paruhbaya')  
ax0.plot(x_usia, usia_tua, 'r', linewidth=1.5, label='Tua')  
ax0.set_title('Indeks Usia Pasien')  
ax0.legend()  
	  
ax1.plot(x_suhubadan, suhu_hipo, 'b', linewidth=1.5, label='Hipotermia')  
ax1.plot(x_suhubadan, suhu_normal, 'g', linewidth=1.5, label='Normal')  
ax1.plot(x_suhubadan, suhu_hiper, 'r', linewidth=1.5, label='Hipertermia')  
ax1.set_title('Indeks Suhu Badan')  
ax1.legend()  
	  
ax2.plot(x_kondnapas, kondnapas_normal, 'b', linewidth=1.5, label='Normal')  
ax2.plot(x_kondnapas, kondnapas_moderat, 'g', linewidth=1.5, label='Moderat')  
ax2.plot(x_kondnapas, kondnapas_abnormal, 'r', linewidth=1.5, label='Abnormal')  
ax2.set_title('Indeks Kondisi Pernapasan')  
ax2.legend()

ax3.plot(x_jmlantbd, jmlantbd_normal, 'b', linewidth=1.5, label='Normal')  
ax3.plot(x_jmlantbd, jmlantbd_moderat, 'g', linewidth=1.5, label='Moderat')  
ax3.plot(x_jmlantbd, jmlantbd_abnormal, 'r', linewidth=1.5, label='Abnormal')  
ax3.set_title('Indeks Jumlah Antibodi')  
ax3.legend()

ax4.plot(x_status, status_negatif, 'g', linewidth=1.5, label='Negatif')
ax4.plot(x_status, status_positif, 'r', linewidth=1.5, label='Positif')
ax4.set_title('Indeks Status Pasien')  
ax4.legend()

for ax in (ax0, ax1, ax2, ax3, ax4):
  ax.spines['top'].set_visible(False)
  ax.spines['right'].set_visible(False)
  ax.get_xaxis().tick_bottom()
  ax.get_yaxis().tick_left()
  plt.tight_layout()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1731301939058172, 'fraction_numerical': 0.07119113573407203, 'mean_word_length': 5.60146252285192, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '455371', 'license': 'MIT', 'n_tokens_mistral': 1857, 'n_tokens_neox': 1693, 'n_words': 272, 'path': 'Plotting_Fuzzy_Logic_Graph_with_Python.ipynb', 'repo_name': 'alfianhid/Plotting-Fuzzy-Logic-Graph-with-Python', 'size': '3610'}