Skip to content

Commit

Permalink
visualization into oop
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-zheng-codes committed Jan 11, 2024
1 parent 5ca02c6 commit 50cfc8a
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions src/ratings_plotter/imaging.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
import matplotlib.pyplot as plt
import numpy as np

# set random seed
np.random.seed(444)

rng = np.arange(50)
rnd = np.random.randint(0, 10, size=(3, rng.size))
yrs = 1950 + rng

fig, ax = plt.subplots(figsize=(5, 3))
ax.stackplot(yrs, rng + rnd, labels=['Eastasia', 'Eurasia', 'Oceania'])
ax.set_title('Combined debt growth over time')
ax.legend(loc='upper left')
ax.set_ylabel('Total debt')
ax.set_xlim(xmin=yrs[0], xmax=yrs[-1])
fig.tight_layout()
plt.show()

class Visualization:
"""Visualization class"""

def __init__(self) -> None:
return

def visualize_ratings(self) -> None:
"""Visualize ratings for a given user ID"""

rng = np.arange(50)
rnd = np.random.randint(0, 10, size=(3, rng.size))
yrs = 1950 + rng

fig, ax = plt.subplots(figsize=(5, 3))
ax.stackplot(yrs, rng + rnd, labels=['Eastasia', 'Eurasia', 'Oceania'])
ax.set_title('Combined debt growth over time')
ax.legend(loc='upper left')
ax.set_ylabel('Total debt')
ax.set_xlim(xmin=yrs[0], xmax=yrs[-1])
fig.tight_layout()
plt.show()


vis = Visualization()
vis.visualize_ratings()

0 comments on commit 50cfc8a

Please sign in to comment.