2

Suppose I have the following:

data_mats = [ ... ]

# pseudo code
cmap = plt.(...).get_cmap('magma', low=0, high=len(data_mats))

for i in range(0,len(data_mats)):

    # pseudo code
    color = cmap(i)

    mat = data_mats[i]
    plt.plot(mat[:,1],mat[:,2], color=color)

How do I fill in the lines of pseudo code:

# lines of pseudo code
cmap = plt.(...).get_cmap('magma', low=0, high=len(data_mats))

color = cmap(i)

Using pyplot?

(why all the dense examples on matplotlib's website, rather than some code specs?)

1 Answer 1

1
import matplotlib.pyplot as plt

i = 10
file_ct = 100

cmap = plt.cm.magma
color = cmap(float(i+1) / float(file_ct)) 
Sign up to request clarification or add additional context in comments.

2 Comments

Is this additional information for your question? Is this what solved your question? What is this? At least add enough text to tell what this is.
@zero298 all of the above. The documentation was complex, but the solution was trivial

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.