Skip to content

Commit

Permalink
[VIZ] tweaking plots
Browse files Browse the repository at this point in the history
  • Loading branch information
hollydinkel committed Sep 7, 2024
1 parent 8bd9be4 commit c232d21
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Enhanced access to space, climate and natural resource monitoring, space-based a
This study measures the innovation success of selected companies worldwide based on internal policies, management approaches, and market demand. Time-series metrics, including Return on Equity, Net Profit Margin, Financial Leverage, Asset Turnover, Asset Growth Rate, Equity Growth Rate, and Liabilities Growth Rate, indicate financial trends for businesses across the commercial EO landscape. An Auto-Regressive Distributed Lag model is also implemented to identify the impacts of assets, equity, liabilities, and number of satellites on company revenue and EBITDA. The model is used to forecast revenue and EBITDA into the future for each company.

<p align="center">
<img src="images/ebitda_separate.png" width="900" title="EBITDA">
<img src="images/revenue_separate.png" width="900" title="Revenue">
<img src="images/ebitda_separate.png" width="700" title="EBITDA">
<img src="images/revenue_separate.png" width="700" title="Revenue">
</p>

<p align="center">
Expand Down
Binary file modified images/ebitda_separate.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 modified images/revenue_separate.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 modified images/satellogic_isp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions src/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def plotKPIs(fig, ax, data, key, companyMetadata, company, ylabel):
return fig

def plotPredictions(fig, ax, company, companyMetadata, time=None, inSamplePrediction=None, outSamplePrediction=None, ground_truth=None, ylabel=None, split=None, plotEverything=False):
size = 22
size = 32
if not plotEverything:
company_color = np.array(companyMetadata[company]["color"]) / 255
ax.set_title(company, fontsize=16, fontweight='bold')
Expand All @@ -56,8 +56,8 @@ def plotPredictions(fig, ax, company, companyMetadata, time=None, inSamplePredic
ax.set_position([box.x0, box.y0 + box.height * 0.2, box.width, box.height * 0.8])
elif plotEverything:
company_color = np.array(companyMetadata[company]["color"]) / 255
ax.set_title(company, fontsize=size, fontweight='bold')
ax.tick_params(axis='both', which='major', labelsize=18)
ax.set_title(company, fontsize=40, fontweight='bold')
ax.tick_params(axis='both', which='major', labelsize=size)
ax.set_xlabel('Year', fontsize=size)
ax.set_ylabel(ylabel, fontsize=size)
ax.set_yscale('symlog')
Expand All @@ -69,16 +69,16 @@ def plotPredictions(fig, ax, company, companyMetadata, time=None, inSamplePredic
ax.xaxis.set_major_locator(ticker.MaxNLocator(nbins=5))
ax.set_ylim([vmin, vmax])
ax.set_xlim([pd.to_datetime('2018-06-01'), pd.to_datetime('2024-12-31')])
ax.plot(time[:-split], inSamplePrediction, color=company_color, linestyle="", marker=".", markersize=18)
ax.plot(time[-split:], outSamplePrediction, color=company_color, marker="*", markersize=18, linestyle="")
ax.plot(time, ground_truth, color=company_color, linestyle="solid", linewidth=12)
ax.plot(time[:-split], inSamplePrediction, color=company_color, alpha=0.7, linestyle="", marker="s", markersize=40)
ax.plot(time[-split:], outSamplePrediction, color=company_color, alpha=0.7, marker="*", markersize=40, linestyle="")
ax.plot(time, ground_truth, color=company_color, linestyle="solid", linewidth=20)
if ylabel=="Revenue $ (USD)":
line1, = ax.plot([], [], color='k', linestyle="", marker=".", markersize=18, label='In-Sample Prediction')
line2, = ax.plot([], [], color='k', marker="*", markersize=18, linestyle="", label='Out-of-Sample Forecast')
line3, = ax.plot([], [], color='k', linestyle="solid", linewidth=12, label='Ground Truth Data')
line1, = ax.plot([], [], color='k', linestyle="", alpha=0.7, marker="s", markersize=40, label='In-Sample Prediction')
line2, = ax.plot([], [], color='k', marker="*", alpha=0.7, markersize=40, linestyle="", label='Out-of-Sample Forecast')
line3, = ax.plot([], [], color='k', linestyle="solid", linewidth=20, label='Ground Truth Data')
# Add the legend with specified labels
fig.legend([line1, line2, line3], ['In-Sample Prediction', 'Out-of-Sample Forecast', 'Ground Truth Data'],
loc='upper center', bbox_to_anchor=(0.5, 0.05), ncol=3, prop={'size': size})
loc='upper center', bbox_to_anchor=(0.5, 0.0), ncol=3, prop={'size': size}, fontsize=size)
return fig

# Fixes setting number of ticks on a symlog scale, copied from:
Expand Down
6 changes: 2 additions & 4 deletions src/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def generate_next_quarters(start_date, n):
fig14, ax14 = plt.subplots(figsize=(10, 7), dpi=300)
fig15, ax15 = plt.subplots(figsize=(10, 7), dpi=300)
fig16, ax16 = plt.subplots(figsize=(10, 7), dpi=300)
fig17, ax17 = plt.subplots(1, 5, figsize=(55, 10), dpi=300)
fig18, ax18 = plt.subplots(1, 5, figsize=(55, 10), dpi=300)
fig17, ax17 = plt.subplots(1, 5, figsize=(70, 10), dpi=300)
fig18, ax18 = plt.subplots(1, 5, figsize=(70, 10), dpi=300)

for i, company in enumerate(companyMetadata):
print("COMPANY: ", company)
Expand Down Expand Up @@ -232,8 +232,6 @@ def generate_next_quarters(start_date, n):
plot_pacf(transformedData["EBITDA_USD"], lags=2, title=company, ax = ax30[i//3, i%3], color = 'red')
plotPredictions(fig17, ax17[i], company, companyMetadata, filteredData["Quarter"], inSamplePredictions1, outSamplePredictions1, transformedData["Revenue_USD"], "Revenue $ (USD)", split, plotEverything=True)
plotPredictions(fig18, ax18[i], company, companyMetadata, filteredData["Quarter"], inSamplePredictions2, outSamplePredictions2, transformedData["EBITDA_USD"], "EBITDA $ (USD)", split, plotEverything=True)
else:
pass

plot_acf(transformedData["Total_Assets_USD"], lags=3, title=company, ax = ax21[i//3, i%3], color = 'red')
plot_pacf(transformedData["Total_Assets_USD"], lags=2, title=company, ax = ax22[i//3, i%3], color = 'red')
Expand Down

0 comments on commit c232d21

Please sign in to comment.