how do you make multiple subplots have the same y axis?

I want the data to be comparable

import matplotlib.pyplot as plt

dt = {

x = [i for i, d in enumerate(list(dt.values())[0])]

plt.plot(x, *list(dt.values()))



import matplotlib.pyplot as plt
import random
import math

dt = {

def random_color():
    return "#%06x" % random.randint(0, 0xFFFFFF)

x = [i for i, d in enumerate(list(dt.values())[0])]

dts = []
for i in list(dt.values()):
    dts += i

min_dt = min(dts)
max_dt = max(dts)
sqr = math.ceil(math.sqrt(len(dt)))

counter = 0

for k, v in dt.items():
    plt.subplot(sqr, sqr, counter+1)
    plt.ylim(min_dt, max_dt)
    plt.plot(x, list(dt.values())[counter], color=random_color())
    counter += 1



CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top