0

I want to scale Y axis so that I can see values, as code below plots cant see anything other than a thin black line. Changing plot height doesn't expand the plot.

import numpy as np
import matplotlib.pyplot as plt

data=np.random.random((4,10000))
plt.rcParams["figure.figsize"] = (20,100)
#or swap line above with one below, still no change in plot height
#fig=plt.figure(figsize=(20, 100))
plt.matshow(data)
plt.show()

One way to do this is just repeat the values then plot result, but I would have thought it possible to just scale the height of the plot?

data_repeated = np.repeat(data, repeats=1000, axis=0)

1 Answer 1

1

You can do it like this:

import numpy as np
import matplotlib.pyplot as plt

data=np.random.random((4, 10000))
plt.figure(figsize=(40, 10))
plt.matshow(data, fignum=1, aspect='auto')

plt.show()

Output:

Resized matshow figure

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.