LoginSignup
1
0

More than 1 year has passed since last update.

はじめに

移植やってます。

matplotlib (Python)

plt.figure()
plt.hist([peptide['m/z'] for peptide in peptides],
    bins = 2000,
    range=(0,4000))
plt.xlabel('m/z, Th')
plt.ylabel('# of peptides within 2 Th bin')

plt.show()

20211227b.png
range=(0,4000)ここがタプルなので嫌な予感が。

どうする? (Ruby)

require 'matplotlib/pyplot'
plt = Matplotlib::Pyplot

plt.figure()
plt.hist(peptides.map{ _1['m/z'] },
    bins = 2000,
    range = [0,4000])
plt.xlabel('m/z, Th')
plt.ylabel('# of peptides within 2 Th bin')

plt.show()

20211227a.png
ちがくね?

select (Ruby)

plt.hist(peptides.map{ _1['m/z'] }.select{ _1 < 4000 },
    bins = 2000)

20211228a.png
まあ、こんなもんか。

: (ruby)

plt.hist(peptides.map{ _1['m/z'] },
    bins: 2000,
    range: [0, 4000])

20211228b.png
おお、ドンずば。

こちらのサイトを参照しました。

メモ

  • Python の matplotlib を学習した
  • 道のりは遠そう
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0