Skip to content

Commit

Permalink
Plot adaptation for github vision results.ipynb reading
Browse files Browse the repository at this point in the history
  • Loading branch information
juldib committed Dec 20, 2024
1 parent 0b89a70 commit 0707de5
Show file tree
Hide file tree
Showing 9 changed files with 1,003 additions and 3,626 deletions.
Binary file added img/evolution_norwegian_influenced_names.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/evolution_norwegian_names.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/norwegian_influenced_name_per_year.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/norwegian_names_trend_per_decade.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/show_influence_amplitude_by_movie_genre.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/show_top10_genre_occurence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4,594 changes: 986 additions & 3,608 deletions results_MS3.ipynb → results.ipynb

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions src/models/trend_by_genres.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pandas as pd
import plotly.express as px
import matplotlib.pyplot as plt

def clean_valid_names(global_names, names_to_remove=["M", "DOCTOR"]):
"""
Expand Down Expand Up @@ -309,15 +310,14 @@ def plot_top_genres(genre_influence, metric):
"""
Create a bar chart for the top N genres and save it as an HTML file.
"""
fig = px.bar(
genre_influence,
x='Genres',
y=metric,
title='Top 10 Most Influential Movie Genres on Names',
labels={'Mean Difference': 'Total Influence Score'},
template='plotly_white'
)
fig.show()
fig, ax = plt.subplots()
ax.bar(genre_influence['Genres'], genre_influence[metric], color='skyblue')
ax.set_title('Top 10 Most Influential Movie Genres on Names')
ax.set_xlabel('Genres')
ax.set_ylabel('Total Influence Score')
plt.xticks(rotation=45, ha='right')
plt.tight_layout()
plt.show()

def get_top_names_by_genre(exploded):
"""
Expand Down
17 changes: 8 additions & 9 deletions src/utils/time_analysis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pandas as pd
import plotly.express as px
import matplotlib.pyplot as plt

def show_influence_by_eras():
prophet = pd.read_csv("data/clean/influenced_names_prophet.csv")
Expand All @@ -11,12 +11,11 @@ def show_influence_by_eras():
labels=["60s", "70s", "80s", "90s", "00s"]
)
eras = influenced_prophet.groupby("Era", observed=False).size().reset_index(name="Count")
fig = px.bar(eras, x="Era", y="Count", title="Number of influenced names per Era")
fig.update_layout(
xaxis_title='Era',
yaxis_title='Count',
template="plotly_white",
width=800
)
fig.show()
fig, ax = plt.subplots()
ax.bar(eras['Era'], eras['Count'])
ax.set_title('Number of influenced names per Era')
ax.set_xlabel('Era')
ax.set_ylabel('Count')
fig.tight_layout()
plt.show()

0 comments on commit 0707de5

Please sign in to comment.