SORU
29 Temmuz 2011, Cuma


Arsa iki matplotlib ile aynı zamanda histogram

Histogram arsa dosya ve hiç bir sorun verilerini kullanarak oluşturdu. Şimdi verileri üstüne koymak istedim başka bir şey yapmam yani aynı histogram dosyası

n,bins,patchs = ax.hist(mydata1,100)
n,bins,patchs = ax.hist(mydata2,100)

ama sorun her intervale için, en yüksek değere sahip tek bar görünen, diğeri gizlidir. Acaba nasıl farklı renkler ile aynı anda iki çubuk arsa olabilir

CEVAP
29 Temmuz 2011, Cuma


Burada çalışan bir örnek var:

import random
import numpy
from matplotlib import pyplot

x = [random.gauss(3,1) for _ in range(400)]
y = [random.gauss(4,2) for _ in range(400)]

bins = numpy.linspace(-10, 10, 100)

pyplot.hist(x, bins, alpha=0.5, label='x')
pyplot.hist(y, bins, alpha=0.5, label='y')
pyplot.legend(loc='upper right')
pyplot.show()

enter image description here

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • GoldgenieOfficial

    GoldgenieOff

    23 Temmuz 2009
  • guillaume2111's channel

    guillaume211

    19 Kasım 2006
  • SuicideSheeep

    SuicideSheee

    8 Ocak 2012