Upgrade to Pro — share decks privately, control downloads, hide ads and more …

可視化ライブラリでWebツールを作ってみた

Cddce6ee5ec153c8dade038f6f75ff04?s=47 yujikawa
December 20, 2017

 可視化ライブラリでWebツールを作ってみた

Pythonのdashを使った可視化ツールのお話です。

Cddce6ee5ec153c8dade038f6f75ff04?s=128

yujikawa

December 20, 2017
Tweet

More Decks by yujikawa

Other Decks in Technology

Transcript

  1. ՄࢹԽϥΠϒϥϦͰ 8FCπʔϧΛ࡞ͬͯΈͨ 1Z'VLVPLB Ώ͔͡Θ!ZVKJLBXB@QZ

  2. ࣗݾ঺հ w ໊લ w ઒্༞࢘ Ώ͔͡Θ  w ॴଐ w

    ΧϥϏφςΫϊϩδʔ w ৬छ w όοΫΤϯυΤϯδχΞ w 5XJUUFS w !ZVKJLBXB@QZ w ࠷ۙ͸&MJYJS΍͍ͬͯ·͢
  3. ڵຯΛ࣋ͬͨํ͸8BOUFEMZͰਃ͠ࠐΈΛ͓ئ͍͠·͢ʂ

  4. ͋Δ೔ͷ͜ͱʜ ຖ݄ɺΈΜͳͷੜ ࢈ੑଌΓ͍͔ͨΒ։ൃͷ ༧࣮৘ใ͘ΕΑ ++*3"Ͱ؅ཧͯ͠ ͍ΔͷͰग़͠·͢ʂ

  5. ͍ͭ΋ͳΒ w +*3"ͷϨϙʔτػೳΛ࢖͏ w +*3"ͷ$47ग़ྗػೳͰࢉग़ ͜͜͸ΤϯδχΞͬΆ͘ πʔϧΛ࡞ͬͯΈΑ͏ʜ

  6. ΍Γ͍ͨ͜ͱ w +*3"͔ΒνέοτΛऔಘ w ݄͝ͱͷݸਓͷ༧࣮৘ใऔಘ w ೔ຖͷνʔϜ༧࣮৘ใऔಘ w ՄࢹԽϥΠϒϥϦͰάϥϑΛඳը w

    ݄͝ͱͷݸਓͷ༧࣮৘ใˠ๮άϥϑ w ೔ຖͷνʔϜ༧࣮৘ใˠંΕઢάϥϑ
  7. ࢖༻ͨ͠ϥΠϒϥϦ w +*3"͔ΒνέοτΛऔಘ w KJSB w ՄࢹԽϥΠϒϥϦͰάϥϑΛඳը w EBTI

  8. +*3"ͷ৘ใऔಘ w +*3"ͷ৘ใΛऔಘ͢Δઐ༻ͷϥΠϒϥϦ͕͋Γ·͢ w IUUQTKJSBSFBEUIFEPDTJPFONBTUFS w Πϯετʔϧํ๏ w QJQJOTUBMMKJSB ؆୯ʂʂ

  9. σʔλՄࢹԽϥΠϒϥϦ w %BTICZQMPUZʢIUUQTQMPUMZQSPEVDUTEBTIʣ w 1ZUIPOͷΈͰάϥϑͷՄࢹԽ͕Ͱ͖Δπʔϧ w QMPUZKT 3FBDUKT 'MBTLͳͲͰߏ੒͞Ε͍ͯΔ

  10. %BTIͷΠϯετʔϧ ެࣜαΠτʹैͬͯΠϯετʔϧ͠·͢ɻ pip install dash==0.19.0 # The core dash backend

    pip install dash-renderer==0.11.1 # The dash front-end pip install dash-html-components==0.8.0 # HTML components pip install dash-core-components==0.15.2 # Supercharged components pip install plotly --upgrade # Plotly graphing library used in examples ͜ΕͰ͋ͱ͸Python͚ͩͰϓϩάϥϛϯάʂԼهͷΑ͏ͳάϥϑΛ࡞ΕΔʂ
  11. %BTIαϯϓϧίʔυ import dash import dash_core_components as dcc import dash_html_components as

    html app = dash.Dash() app.layout = html.Div(children=[ html.H1(children='Hello Dash'), html.Div(children=''' Dash: A web application framework for Python. '''), dcc.Graph( id='example-graph', figure={ 'data': [ {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'}, {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'}, ], 'layout': { 'title': 'Dash Data Visualization' } } ) ]) if __name__ == '__main__': app.run_server(debug=True)
  12. ࡞ͬͨ΋ͷ ೔෇Λೖྗͯ͠ૹ৴͢Δͱ ͦͷظؒͷνέοτ৘ใΛ औಘूܭΛߦ͍ඳը͢Δ IUUQTHJUIVCDPNZVKJLBXBKJSBEBTI

  13. ·ͱΊ %BTI͸׳ΕΔͷʹͪΐͬͱ͕࣌ؒඞཁɻ·ͨ+BWB4DSJQU͸ ઈରॻ͖ͨ͘ͳ͍ͱ͍͏1ZUIPOJTUʹ͸͓͢͢Ίɻ ͦ͏͡Όͳ͍ਓ͸%KT΍DIBSUKTͳͲ͍Ζ͍Ζ͋Γ·͢ͷ ͰͦͪΒΛ࢖ͬͨํ͕ྑ͍͔΋͠Ε·ͤΜɻ +BWB4DSJQUͷษڧ͍ͨ͠ํ͸ʜʜʜ

  14. +BWB4DSJQUΛ࢖͍ͬͯΔٕज़ऀಉ͕࢜ަྲྀͰ͖Δ ίϛϡχςΟΛฐࣾͷϑϩϯτϝϯόʔ͕࡞Γ·ͨ͠ ॳճΠϕϯτ͸ʢۚʣ ਃࠐઌɿIUUQTGVLVPLBKTDPOOQBTTDPNFWFOU

  15. ͪͳΈʹ ʮ1ZUIPOϥΠϒϥϦΛ&MJYJSͰ։ൃͯ͠Έͨʯͱ͍͏ςʔϚͰൃද͠·͢

  16. ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠