#lang en <> = Description = [[https://matplotlib.org/|Matplotlib]] is a comprehensive library for creating static, animated, and interactive visualizations in Python. = Snippets = === Standard import === {{{#!highlight python import numpy as np import pandas as pd import matplotlib.pyplot as plt }}} === Bar graph with 3 y-axi === {{{#!highlight python x = np.arange(len(df['Index Column'])) # the label locations width = 0.20 # the width of the bars fig, ax1 = plt.subplots(figsize=(16,7)) ax1.bar(x - 1 * width, df['Column A'], width, label='Column A', color='C0') ax1.set_ylabel('Column A', color='C0') ax1.yaxis.label.set_size(18) ax1.set_xticks(x) ax1.set_xticklabels(df['Index Column'], rotation='vertical', size=15) ax1.legend(bbox_to_anchor=(1, 1), prop={'size': 15}) ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis ax2.bar(x * width, df['Column B'], width, label='Column B', color='C1') ax2.set_ylabel('Column B', color='C1') ax2.yaxis.label.set_size(18) ax2.legend(bbox_to_anchor=(1, .9), prop={'size': 15}) ax2.spines["right"].set_position(("axes", 1.0)) ax3 = ax1.twinx() ax3.bar(x + 1 * width, df['Column C'], width, label='Column C', color='C2') #ax3.set_yscale('log') ax3.set_ylabel('Column C', color='C2') ax3.yaxis.label.set_size(18) ax3.legend(bbox_to_anchor=(1, .8), prop={'size': 15}) ax3.spines["right"].set_position(("axes", 1.06)) plt.show() }}}