1

Suppose you have a list of length "i", containing tuples or lists of tuples with length "j" (such that a singular tuple will have j=1), each of which contain "k" elements.

I am attempting to make a plotting routine such that there are "i" subplots, each with "j" lines.

This is what I have so far, where "rows" and "cols" are pre-determined integers to determine the subplot layout:

for i in range(0, len(x_lolots)):
    for j in range(0, len(x_lolots[i])):
        for k in range(0, len(x_lolots[i][j])):
            plt.ion()
            plt.subplot(rows, cols, (i+1))
            plt.plot(x_lolots[i][j][k], y_lolots[i][j][k])

This gives me the correct arrangement of subplots, but shows no lines.

Any advice?

1 Answer 1

2

plt.plot takes 1d-arrays as input, so the last for loop over k is not necessary.

for i in range(0, len(x_lolots)):
    for j in range(0, len(x_lolots[i])):
        plt.ion()
        plt.subplot(rows, cols, (i+1))
        plt.plot(x_lolots[i][j], y_lolots[i][j])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.