Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.3 kB
1
Indexable
import matplotlib.pyplot as plt
import numpy as np

# Define the labels and data for the graph
labels = ['Share Capital', 'Reserves and Surplus', 'Non-Current Liabilities',
          'Long-term Borrowings', 'Current Liabilities', 'Deposits',
          'Other Current Liabilities', 'Total', 'Non-Current Assets',
          'Property, Plant and Equipment', 'Long-term Loans and Advances',
          'Current Assets', 'Investments', 'Cash and Bank Balances',
          'Other Assets']

data1 = np.array([[16563803, 13865114],
                  [1688555941, 1461226736],
                  [1072313597, 916309564],
                  [10645716132, 9325221605],
                  [689827947, 587703739],
                  [14112977420, 12304326758],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0]])

data2 = np.array([[0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [0, 0],
                  [93738159, 88775806],
                  [8590204390, 7337290904],
                  [3102410024, 2812865399],
                  [0, 0],
                  [0, 0],
                  [648401215, 734112148],
                  [0, 0],
                  [0, 0],
                  [0, 0]])

# Set up the graph
x = np.arange(len(labels))
width = 0.35

fig, ax = plt.subplots(figsize=(12,8))

# Plot the bars for Company A
rects1 = ax.bar(x - width/2, data1[:,0], width, label='Company A')

# Plot the bars for Company B
rects2 = ax.bar(x + width/2, data1[:,1], width, label='Company B')

# Plot the bars for Company A (with alpha value to make them transparent)
rects3 = ax.bar(x - width/2, data2[:,0], width, alpha=0.5)

# Plot the bars for Company B (with alpha value to make them transparent)
rects4 = ax.bar(x + width/2, data2[:,1], width, alpha=0.5)

# Add labels and title to the graph
ax.set_xticks(x)
ax.set_xticklabels(labels, rotation=90)
ax.set_ylabel('Amount (in crores)')
ax.set_title('Comparison of Company A and Company B')

# Add a legend to the graph
ax.legend()

# Display the graph
plt.show()