Displaying plot of death rates from past years in Poland. Data source from these years is in readme

Overview

Average-Death-Rate

Displaying plot of death rates from past years in Poland


The goal

  1. collect the data from a CSV file
  2. count the ADR (Average Death Rate) from years 2015-2019 and 2020+
  3. change this data to float and add it into a list
  4. create a python data plot on which OX are the years and OY ADR data

Data source

Data source: death statistics from 1 september 2015


Demo Tests

Just to show how does matplotlib work:

In the real project, I will have two plots on one displayed interface. Those are divided into subplots, which in this case, there will be two of them.


The idea of the first plot. This data is from the actual source (not the one from my code).



Project source

Charts show data where data arrays are the same. First data array that goes on to OX should have the same length as data array on OY, so basically x = y without mentioning data types (except for str and bool). The few things to mention within the code in src directory are here just in case that you want it to work:



Debuggers

While checking if everything goes alright, I have used DBG's in my code and most of them are turned off. To turn them on, you can simply just change the DBG state:

    _DBG8_ = True                   # Other
    _DBG9_ = True                   # Standard debug

I have used _DBG9_ to check if class inside of count.py was giving the right answers. Around the class and programs inside of src directory, after each operation there is a debugger with an if. With a print() function, I could see if the operation was made correctly and at the same time, I was going on to the next line to see clearly if the next operation made was successful:

    if (_DBG9_): print('ls =', ls, '\n\n')



Screenshots and generating plots

All of these screenshots are made from a data science library to visualize data, matplotlib. On matplotlib, I set label of OX axis to 'Years' and OY axis to 'ADR'. Of course, the data for 'Years' and 'ADR' was generated within Operations() class inside of count.py file. Next, I needed to visualize the data on chart, so I used matplotlib plot function to show data on both, OX and OY axis and decorated them a bit by adding marker argument to plot function. I have also added a label to the graph:

    plt.title("ADR data chart from 2015")
    plt.xlabel('Years')         # OX label: years from 2015
    plt.ylabel('ADR')           # OY label: ADR (short: average death rate)


    # 2. adding plot:
    plt.plot(ls_years, ls_main_data, label='ADR', marker='o')      # OX data, OY data,

To show the label of main graph, you need to add the following function:

    plt.legend()

The final result:


The data should be displayed on two plots (or subplots). To do that, subplots() method was used for this. There are two subplots, and one column. To divide this into two rows and one column, the subplots() takes two arguments which describes the number of rows and columns:

    fig, ax = plt.subplots(nrows=row_num, ncols=col_num)

    figure, (axis0, axis1) = plt.subplots(nrows=2, ncols=1)      # In this project, this was made using these args

axis0 and axis1 are describing axis that the plot is on. Then for plot method, we don't use plt.plot(), label or titles because we assign different plots to different axis (in this case):

    figure, (axis0, axis1) = plt.subplots(nrows=2, ncols=1)

    axis0.set_title("ADR data charts 2015 - 2021")
    axis0.set_xlabel('Years')         # OX label: years from 2015
    axis0.set_ylabel('ADR')           # OY label: ADR (short: average death rate)

    axis0.plot(ls_years, ls_main_data, label='ADR', marker='o')      # OX data, OY data
    axis0.legend()
    axis0.grid(True)
    
    
    
    axis1.set_xlabel('Years (2020 - 2021+)')         # OX label: years from 2020
    axis1.set_ylabel('ADR')           # OY label: ADR (short: average death rate)

    axis1.plot(ls_second_years, ls_main_data[5:], label='ADR', marker='o', color='orange')
    axis1.legend()
    axis1.grid(True)
    
    plt.show()

At the end, we give plt.show() method because we want to display the whole data chart. The final result is here:

Updates:

03.09: adding standard deviation plot

Owner
Oliwier Szymański
self-taught coder. Most of my projects are written in Python or Java. I'm trying to learn from mistakes that I made in my codes and not only
Oliwier Szymański
:small_red_triangle: Ternary plotting library for python with matplotlib

python-ternary This is a plotting library for use with matplotlib to make ternary plots plots in the two dimensional simplex projected onto a two dime

Marc 611 Dec 29, 2022
Draw datasets from within Jupyter.

drawdata This small python app allows you to draw a dataset in a jupyter notebook. This should be very useful when teaching machine learning algorithm

vincent d warmerdam 505 Nov 27, 2022
Flow-based visual scripting for Python

A simple visual node editor for Python Ryven combines flow-based visual scripting with Python. It gives you absolute freedom for your nodes and a simp

Leon Thomm 3.1k Jan 06, 2023
Print matplotlib colors

mplcolors Tired of searching "matplotlib colors" every week/day/hour? This simple script displays them all conveniently right in your terminal emulato

Brandon Barker 32 Dec 13, 2022
LabGraph is a a Python-first framework used to build sophisticated research systems with real-time streaming, graph API, and parallelism.

LabGraph is a a Python-first framework used to build sophisticated research systems with real-time streaming, graph API, and parallelism.

MLH Fellowship 7 Oct 05, 2022
nvitop, an interactive NVIDIA-GPU process viewer, the one-stop solution for GPU process management

An interactive NVIDIA-GPU process viewer, the one-stop solution for GPU process management.

Xuehai Pan 1.3k Jan 02, 2023
Yata is a fast, simple and easy Data Visulaization tool, running on python dash

Yata is a fast, simple and easy Data Visulaization tool, running on python dash. The main goal of Yata is to provide a easy way for persons with little programming knowledge to visualize their data e

Cybercreek 3 Jun 28, 2021
Backend app for visualizing CANedge log files in Grafana (directly from local disk or S3)

CANedge Grafana Backend - Visualize CAN/LIN Data in Dashboards This project enables easy dashboard visualization of log files from the CANedge CAN/LIN

13 Dec 15, 2022
BrowZen correlates your emotional states with the web sites you visit to give you actionable insights about how you spend your time browsing the web.

BrowZen BrowZen correlates your emotional states with the web sites you visit to give you actionable insights about how you spend your time browsing t

Nick Bild 36 Sep 28, 2022
view cool stats related to your discord account.

DiscoStats cool statistics generated using your discord data. How? DiscoStats is not a service that breaks the Discord Terms of Service or Community G

ibrahim hisham 5 Jun 02, 2022
A high performance implementation of HDBSCAN clustering. http://hdbscan.readthedocs.io/en/latest/

HDBSCAN Now a part of scikit-learn-contrib HDBSCAN - Hierarchical Density-Based Spatial Clustering of Applications with Noise. Performs DBSCAN over va

Leland McInnes 91 Dec 29, 2022
A tool for creating Toontown-style nametags in Panda3D

Toontown-Nametag Toontown-Nametag is a tool for creating Toontown Online/Toontown Rewritten-style nametags in Panda3D. It contains a function, createN

BoggoTV 2 Dec 23, 2021
Process dataframe in a easily way.

Popanda Written by Shengxuan Wang at OSU. Used for processing dataframe, especially for machine learning. The name is from "Po" in the movie Kung Fu P

ShawnWang 1 Dec 24, 2021
Designed a greedy algorithm based on Markov sequential decision-making process in MATLAB/Python to optimize using Gurobi solver

Designed a greedy algorithm based on Markov sequential decision-making process in MATLAB/Python to optimize using Gurobi solver, the wheel size, gear shifting sequence by modeling drivetrain constrai

Sabbella Prasanna 1 Jan 11, 2022
Dipto Chakrabarty 7 Sep 06, 2022
阴阳师后台全平台(使用网易 MuMu 模拟器)辅助。支持御魂,觉醒,御灵,结界突破,秘闻副本,地域鬼王。

阴阳师后台全平台辅助 Python 版本:Python 3.8.3 模拟器:网易 MuMu | 雷电模拟器 模拟器分辨率:1024*576 显卡渲染模式:兼容(OpenGL) 兼容 Windows 系统和 MacOS 系统 思路: 利用 adb 截图后,使用 opencv 找图找色,模拟点击。使用

简讯 27 Jul 09, 2022
A simple interpreted language for creating basic mathematical graphs.

graphr Introduction graphr is a small language written to create basic mathematical graphs. It is an interpreted language written in python and essent

2 Dec 26, 2021
BGraph is a tool designed to generate dependencies graphs from Android.bp soong files.

BGraph BGraph is a tool designed to generate dependencies graphs from Android.bp soong files. Overview BGraph (for Build-Graphs) is a project aimed at

Quarkslab 10 Dec 19, 2022
Blender addon that creates a temporary window of any type from the 3D View.

CreateTempWindow2.8 Blender addon that creates a temporary window of any type from the 3D View. Features Can the following window types: 3D View Graph

3 Nov 27, 2022
100 Days of Code The Complete Python Pro Bootcamp for 2022

100-Day-With-Python 100 Days of Code - The Complete Python Pro Bootcamp for 2022. In this course, I spend with python language over 100 days, and I up

Rajdip Das 8 Jun 22, 2022