Skip to content

Instantly share code, notes, and snippets.

View Thiagobc23's full-sized avatar

Thiago Bernardes Carvalho Thiagobc23

View GitHub Profile
@Thiagobc23
Thiagobc23 / connected_scatter.py
Last active November 2, 2021 02:25
Connected Scatter Plot with Matplotlib
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
import numpy as np
import pandas as pd
url = 'https://gist.githubusercontent.com/Thiagobc23/4ccb4ea1c612d9d68921bf990ce28855/raw/6225824a6b7d5d273019c09c25cbbaa5b82009bc/dummy_data.csv'
df = pd.read_csv(url, index_col='ID')
# figure
# data
@Thiagobc23
Thiagobc23 / secondary_axis.py
Last active November 2, 2021 02:21
Matplotlib line charts with secondary axis | dual-axis | double-axis
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
url = 'https://gist.githubusercontent.com/Thiagobc23/4ccb4ea1c612d9d68921bf990ce28855/raw/6225824a6b7d5d273019c09c25cbbaa5b82009bc/dummy_data.csv'
df = pd.read_csv(url, index_col='ID')
# figure
fig, ax = plt.subplots(1, figsize=(12,4), facecolor='#293952')
ax.set_facecolor('#293952')
@Thiagobc23
Thiagobc23 / smooth_chart.py
Last active October 28, 2021 03:14
Smooth line chart with Matplotlib (scipy interpolate)
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import interpolate
url = 'https://gist.githubusercontent.com/Thiagobc23/4ccb4ea1c612d9d68921bf990ce28855/raw/6225824a6b7d5d273019c09c25cbbaa5b82009bc/dummy_data.csv'
df = pd.read_csv(url, index_col='ID')
# figure
fig, ax = plt.subplots(1, figsize=(12,4), facecolor='#293952')
@Thiagobc23
Thiagobc23 / gantt.py
Last active March 30, 2024 16:54
Gantt Chart with Matplotlib v2
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from pandas import Timestamp
##### DATA #####
data = {'Task': {0: 'TSK M',
1: 'TSK N',
2: 'TSK L',
@Thiagobc23
Thiagobc23 / gantt.py
Created August 30, 2021 02:46
Gantt chart with Matplotlib
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from pandas import Timestamp
##### DATA #####
data = {'Task': {0: 'TSK M',
1: 'TSK N',
2: 'TSK L',
@Thiagobc23
Thiagobc23 / countries
Last active April 9, 2021 19:53
List of countries from world bank for cleaning datasets
# countries from https://data.worldbank.org/country
all_countries = ['Afghanistan', 'Albania', 'Algeria', 'American Samoa',
'Andorra', 'Angola', 'Antigua and Barbuda', 'Argentina',
'Armenia', 'Aruba', 'Australia', 'Austria', 'Azerbaijan',
'Bahamas, The', 'Bahrain', 'Bangladesh', 'Barbados',
'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda',
'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana',
'Brazil', 'British Virgin Islands', 'Brunei Darussalam',
'Bulgaria', 'Burkina Faso', 'Burundi', 'Cabo Verde',
'Cambodia', 'Cameroon', 'Canada', 'Cayman Islands',