1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

✅ Plotly の特徴(わかりやすく)

  1. インタラクティブ(動くグラフ)

Plotly の最大の強みです。
• マウスでズーム
• 値にマウスを合わせると詳細表示
• グラフをドラッグして動かせる
• 凡例で表示・非表示を切り替え

静止画しか作れない matplotlib / seaborn とは大きく違います。

✅ 2. Web向けのグラフを作りやすい

Plotly は JavaScript (plotly.js) がベースなので Web と相性が良いです。
• Flask / Django / FastAPI と組み合わせやすい
• Jupyter Notebook / Google Colab でそのまま動作
• React 用の Plotly(react-plotly.js)もある → SNSアプリにも使える

🔥 Plotly でできる代表的なグラフ

グラフ コード例
折れ線グラフ px.line()
散布図 px.scatter()
棒グラフ px.bar()
箱ひげ図 px.box()
ヒートマップ px.imshow()
地図プロット(世界地図 / 日本地図) px.choropleth()
3Dグラフ px.scatter_3d()
アニメーション px.scatter(..., animation_frame=...)

📌 基本的な例:散布図

import plotly.express as px

df = px.data.iris()  # 有名なデータセット

fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species")

fig.show()

Adobe Express - 画面収録 2025-12-02 7.54.31.gif

📌 ヒートマップ(相関行列)

import plotly.express as px
import pandas as pd

tips = px.data.tips()

# 数値列だけ使う
corr = tips.select_dtypes(include=["number"]).corr()

fig = px.imshow(corr, text_auto=True)
fig.show()

Adobe Express - 画面収録 2025-12-02 7.49.36.gif

1
0
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?