mardi 21 avril 2015

How to define several figure-objects in matplotlib?

Vote count: 0

I would like to define two figures objects and then in a loop I would like to contribute to each of them. The following code will not work but it demonstrate how it works.

import matplotlib.pyplot as plt

plt1.figure()
plt1.xticks(rotation=90)

plt2.figure()
plt2.xticks(rotation=90)

for i in range(5):

   plt1.plot(xs_a[i], ys_a[i], label='line' + str(i))
   plt2.plot(xs_b[i], ys_b[i], label='line' + str(i))

plt1.savefig(fname_1)
plt2.savefig(fname_2)

I always perceived plt as an image object for which I can set some parameters (for example xticks) or to which I can add some curves. However, plt is a library that I import. So, what I should do when I need to define two or more figure objects?

asked 2 mins ago
Roman
9,483



How to define several figure-objects in matplotlib?

Aucun commentaire:

Enregistrer un commentaire