Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Visualizing Combined Financial Data | Retrieving and Reporting Financial Data
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Python for Accountants

bookVisualizing Combined Financial Data

Visualizing combined datasets is crucial for accountants who need a comprehensive view of financial performance. By bringing together internal records, such as company revenue, and external data, like market trends or competitor benchmarks, you can:

  • Identify correlations;
  • Spot outliers;
  • Make more informed decisions.

Visualization helps reveal relationships that may not be obvious in raw data, making it easier to communicate findings to stakeholders and drive strategic planning.

123456789101112131415161718192021222324252627
import matplotlib.pyplot as plt # Example internal revenue data (in thousands) months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"] internal_revenue = [120, 135, 150, 160, 145, 170] # Example external market index (normalized) market_trends = [1.02, 1.05, 1.07, 1.09, 1.06, 1.12] fig, ax1 = plt.subplots() # Plot internal revenue on left y-axis color = 'tab:blue' ax1.set_xlabel('Month') ax1.set_ylabel('Internal Revenue (K USD)', color=color) ax1.plot(months, internal_revenue, color=color, marker='o', label='Internal Revenue') ax1.tick_params(axis='y', labelcolor=color) # Create a second y-axis for the external data ax2 = ax1.twinx() color = 'tab:red' ax2.set_ylabel('Market Trend (Index)', color=color) ax2.plot(months, market_trends, color=color, marker='s', label='Market Trend') ax2.tick_params(axis='y', labelcolor=color) plt.title('Internal Revenue vs. External Market Trends') plt.show()
copy

When you interpret combined visualizations, such as a dual-axis plot, you can quickly assess whether your organization's internal revenue is moving in tandem with broader market trends. If both lines rise and fall together, it may indicate your business is closely following market conditions. Divergence between the two could signal unique risks or opportunities. These insights help you identify whether internal performance is driven by external forces or by company-specific factors, supporting better forecasting and decision-making.

1234567891011121314151617181920212223242526272829
import matplotlib.pyplot as plt months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"] internal_revenue = [120, 135, 150, 160, 145, 170] market_trends = [1.02, 1.05, 1.07, 1.09, 1.06, 1.12] fig, ax1 = plt.subplots() # Plot internal revenue ax1.plot(months, internal_revenue, color='navy', marker='o', linestyle='-', linewidth=2, label='Internal Revenue') ax1.set_xlabel('Month') ax1.set_ylabel('Internal Revenue (K USD)', color='navy') ax1.tick_params(axis='y', labelcolor='navy') # Plot external market trend on secondary axis ax2 = ax1.twinx() ax2.plot(months, market_trends, color='crimson', marker='s', linestyle='--', linewidth=2, label='Market Trend') ax2.set_ylabel('Market Trend (Index)', color='crimson') ax2.tick_params(axis='y', labelcolor='crimson') # Add legends for both axes lines_1, labels_1 = ax1.get_legend_handles_labels() lines_2, labels_2 = ax2.get_legend_handles_labels() plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper left') plt.title('Internal Revenue vs. External Market Trends (Styled)') plt.grid(True, axis='y', linestyle=':', alpha=0.6) plt.tight_layout() plt.show()
copy

1. What is the advantage of using dual-axis plots in financial analysis?

2. Which matplotlib function allows you to add a secondary y-axis?

3. Fill in the blank with the correct matplotlib function to create a secondary y-axis.

question mark

What is the advantage of using dual-axis plots in financial analysis?

Select the correct answer

question mark

Which matplotlib function allows you to add a secondary y-axis?

Select the correct answer

question-icon

Fill in the blank with the correct matplotlib function to create a secondary y-axis.

ax2 = ax1.()

Click or drag`n`drop items and fill in the blanks

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

bookVisualizing Combined Financial Data

Swipe to show menu

Visualizing combined datasets is crucial for accountants who need a comprehensive view of financial performance. By bringing together internal records, such as company revenue, and external data, like market trends or competitor benchmarks, you can:

  • Identify correlations;
  • Spot outliers;
  • Make more informed decisions.

Visualization helps reveal relationships that may not be obvious in raw data, making it easier to communicate findings to stakeholders and drive strategic planning.

123456789101112131415161718192021222324252627
import matplotlib.pyplot as plt # Example internal revenue data (in thousands) months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"] internal_revenue = [120, 135, 150, 160, 145, 170] # Example external market index (normalized) market_trends = [1.02, 1.05, 1.07, 1.09, 1.06, 1.12] fig, ax1 = plt.subplots() # Plot internal revenue on left y-axis color = 'tab:blue' ax1.set_xlabel('Month') ax1.set_ylabel('Internal Revenue (K USD)', color=color) ax1.plot(months, internal_revenue, color=color, marker='o', label='Internal Revenue') ax1.tick_params(axis='y', labelcolor=color) # Create a second y-axis for the external data ax2 = ax1.twinx() color = 'tab:red' ax2.set_ylabel('Market Trend (Index)', color=color) ax2.plot(months, market_trends, color=color, marker='s', label='Market Trend') ax2.tick_params(axis='y', labelcolor=color) plt.title('Internal Revenue vs. External Market Trends') plt.show()
copy

When you interpret combined visualizations, such as a dual-axis plot, you can quickly assess whether your organization's internal revenue is moving in tandem with broader market trends. If both lines rise and fall together, it may indicate your business is closely following market conditions. Divergence between the two could signal unique risks or opportunities. These insights help you identify whether internal performance is driven by external forces or by company-specific factors, supporting better forecasting and decision-making.

1234567891011121314151617181920212223242526272829
import matplotlib.pyplot as plt months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"] internal_revenue = [120, 135, 150, 160, 145, 170] market_trends = [1.02, 1.05, 1.07, 1.09, 1.06, 1.12] fig, ax1 = plt.subplots() # Plot internal revenue ax1.plot(months, internal_revenue, color='navy', marker='o', linestyle='-', linewidth=2, label='Internal Revenue') ax1.set_xlabel('Month') ax1.set_ylabel('Internal Revenue (K USD)', color='navy') ax1.tick_params(axis='y', labelcolor='navy') # Plot external market trend on secondary axis ax2 = ax1.twinx() ax2.plot(months, market_trends, color='crimson', marker='s', linestyle='--', linewidth=2, label='Market Trend') ax2.set_ylabel('Market Trend (Index)', color='crimson') ax2.tick_params(axis='y', labelcolor='crimson') # Add legends for both axes lines_1, labels_1 = ax1.get_legend_handles_labels() lines_2, labels_2 = ax2.get_legend_handles_labels() plt.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper left') plt.title('Internal Revenue vs. External Market Trends (Styled)') plt.grid(True, axis='y', linestyle=':', alpha=0.6) plt.tight_layout() plt.show()
copy

1. What is the advantage of using dual-axis plots in financial analysis?

2. Which matplotlib function allows you to add a secondary y-axis?

3. Fill in the blank with the correct matplotlib function to create a secondary y-axis.

question mark

What is the advantage of using dual-axis plots in financial analysis?

Select the correct answer

question mark

Which matplotlib function allows you to add a secondary y-axis?

Select the correct answer

question-icon

Fill in the blank with the correct matplotlib function to create a secondary y-axis.

ax2 = ax1.()

Click or drag`n`drop items and fill in the blanks

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3
some-alt