plot as individual "colorbars"

Tony Yu <tsyu80@...287...> writes:

Does the following do what you need?

#----
import numpy as np
import matplotlib.pyplot as plt

width = 0.5
height = 10

for x in np.arange(11):
strip = np.random.random(size=(50, 1))
plt.imshow(strip, extent=(x-width/2, x+width/2, 0, height))

plt.xlim(-width, x+width)

plt.show()
#----

Not completely since it requires an equally spaced "strip". I have two
vectors (one for the vertical axis, one for the data).

Best regards

Ole

I’m not sure what you mean by equally spaced strip. If you need to scale the height, you can just calculate it as from the length of the strip. If you mean the placement of the strips, you can substitue the x values above with your data instead of the arange call—you’d have to appropriately scale width so that matches your x-spacing.

-Tony

···

On Tue, Feb 14, 2012 at 10:33 AM, Olе Streicher <ole-usenet-spam@…361…> wrote:

Tony Yu <tsyu80@…878…287…> writes:

Does the following do what you need?

#----

import numpy as np

import matplotlib.pyplot as plt

width = 0.5

height = 10

for x in np.arange(11):

strip = np.random.random(size=(50, 1))
plt.imshow(strip, extent=(x-width/2, x+width/2, 0, height))

plt.xlim(-width, x+width)

plt.show()

#----

Not completely since it requires an equally spaced “strip”. I have two

vectors (one for the vertical axis, one for the data).

Best regards

Ole

Could you provide a /working/ example with the geometry you really want?
I believe I thought more or less about it as Tony Yu did. If it is wrong, be more precise, please.

Jerzy Karczmarczuk