๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ - plotly(python)

2026. 4. 17. 12:26ยท๐Ÿ“‚ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ

plotly

 

 

โœ… Plotly๋ž€?


๋ฐ์ดํ„ฐ๋ฅผ “์ธํ„ฐ๋ž™ํ‹ฐ๋ธŒ(์ƒํ˜ธ์ž‘์šฉ)”ํ•˜๊ฒŒ ์‹œ๊ฐํ™”ํ•ด์ฃผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ

 

์„ค์น˜

pip install dash

 

 

https://dash.plotly.com/layout

 

Part 1. Layout | Dash for Python Documentation | Plotly

This is the 1st chapter of the Dash Fundamentals. The next chapter covers Dash callbacks. # Run this app with `python app.py` and # visit http://127.0.0.1:8050/ in your web browser. from dash import Dash, html, dcc import plotly.express as px import pandas

dash.plotly.com

 

๊ฐœ๋…

2๊ฐ€์ง€ ๊ฐœ๋…์ด ์žˆ๋‹ค.

๋ ˆ์ด์•„์›ƒ(Dash HTML Components), ์ฝœ๋ฐฑ(Dash Core Components)

 

๋ ˆ์ด์•„์›ƒ์€ html์„ ํ™”๋ฉด์— ๋„์šฐ๋Š” ๊ฒƒ, ์ฝœ๋ฐฑ์€ ๋ชจ๋“  ๊ฒƒ๋“ค์„ interactiveํ•˜๊ฒŒ ๋งŒ๋“ค์–ด์คŒ

 

Dash, Plotly

Dash: Python์„ react application์œผ๋กœ ๋งŒ๋“ค์–ด์„œ interactiveํ•˜๊ฒŒ ๋งŒ๋“ค์–ด์ค€๋‹ค.

Plotly: ์˜คํ”ˆ์†Œ์Šค Graphing Libraries. ๋ฐ์ดํ„ฐ ์‹œ๊ฐํ™”๋ฅผ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์คŒ.

 

 

โœ… Plotly


https://plotly.com/python-api-reference/generated/plotly.express.scatter_geo.html

 

plotly.express.scatter_geo — 6.6.0 documentation

hover_data (str, or list of str or int, or Series or array-like, or dict) – Either a name or list of names of columns in data_frame, or pandas Series, or array_like objects or a dict with column names as keys, with values True (for default formatting) Fa

plotly.com

 

https://plotly.com/python/templates/

 

Theming

Over 25 examples of Theming and templates including changing color, size, log axes, and more in Python.

plotly.com

 

from dash import Dash, html
import plotly.express as px
from data import countries_df
from builders import make_table

stylesheets = [
    "https://cdn.jsdelivr.net/npm/reset-css@5.0.2/reset.min.css",
    "https://fonts.googleapis.com/css2?family=Open+Sans&display=swap",
]

app = Dash(external_stylesheets=stylesheets)

app.layout = html.Div(
    style={
        "minHeight": "100vh",
        "backgroundColor": "#111111",
        "color": "white",
        "fontFamily": "Open Sans, sans-serif",
    },
    children=[
        html.Header(
            style={"textAlign": "center", "paddingTop": "50px", "marginBottom": 100},
            children=html.H1("Corona Dashboard", style={"fontSize": 40}),
        ),
        html.Div(children=[html.Div(children=[make_table(countries_df)])]),
    ],
)

map_figure = px.scatter_geo(
    countries_df,
    size="Confirmed",
    hover_name="Country_Region",
    locations="Country_Region",
    locationmode="country names",
    size_max=40,
    color="Confirmed",
    template="plotly_dark",
    hover_data={
        "Confirmed": ":,",
        "Recovered": ":,",
        "Deaths": ":,",
        "Country_Region": False,
    },
)
map_figure.show()

if __name__ == "__main__":
    app.run(debug=True)

 

callback

from dash import Dash, html, dcc
import plotly.express as px
from data import countries_df, totals_df
from builders import make_table
from dash.dependencies import Input, Output

stylesheets = [
    "https://cdn.jsdelivr.net/npm/reset-css@5.0.2/reset.min.css",
    "https://fonts.googleapis.com/css2?family=Open+Sans&display=swap",
]

app = Dash(external_stylesheets=stylesheets)

bubble_map = px.scatter_geo(
    countries_df,
    size="Confirmed",
    hover_name="Country_Region",
    locations="Country_Region",
    locationmode="country names",
    size_max=40,
    title="Confirmed By Country",
    color="Confirmed",
    template="plotly_dark",
    color_continuous_scale=px.colors.sequential.Oryel,
    # projection="natural earth",
    hover_data={
        "Confirmed": ":,",
        "Recovered": ":,",
        "Deaths": ":,",
        "Country_Region": False,
    },
)

bars_graph = px.bar(
    totals_df,
    x="condition",
    y="count",
    template="plotly_dark",
    title="Total Global Cases",
    hover_data={"count": ":,"},
    labels={"condition": "Condition", "count": "Count", "color": "Condition"},
)

bars_graph.update_traces(marker_color=["#e74c3c", "#8e44ad", "#27ae60"])

app.layout = html.Div(
    style={
        "minHeight": "100vh",
        "backgroundColor": "#111111",
        "color": "white",
        "fontFamily": "Open Sans, sans-serif",
    },
    children=[
        html.Header(
            style={"textAlign": "center", "paddingTop": "50px", "marginBottom": 100},
            children=html.H1("Corona Dashboard", style={"fontSize": 40}),
        ),
        html.Div(
            style={
                "display": "grid",
                "gap": 50,
                "gridTemplateColumns": "repeat(4, 1fr)",
            },
            children=[
                html.Div(
                    style={"grid-column": "span 3"},
                    children=[dcc.Graph(figure=bubble_map)],
                ),
                html.Div(children=[make_table(countries_df)]),
            ],
        ),
        html.Div(
            style={
                "display": "grid",
                "gap": 50,
                "gridTemplateColumns": "repeat(4, 1fr)",
            },
            children=[
                html.Div(children=[dcc.Graph(figure=bars_graph)]),
                html.Div(
                    children=[
                        dcc.Input(
                            style={"color": "black"},
                            placeholder="What is your name?",
                            id="hello-input",
                        ),
                        html.H2(children="Hello Anonymous", id="hello-output"),
                    ],
                ),
            ],
        ),
    ],
)


@app.callback(Output("hello-output", "children"), [Input("hello-input", "value")])
def update_hello(value):
    if value is None:
        return "Hello Anonymous"
    else:
        return f"Hello {value}"


if __name__ == "__main__":
    app.run(debug=True)

'๐Ÿ“‚ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ - Shadcn/ui  (0) 2026.04.27
๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ - Jupyter  (0) 2026.04.17
๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ - pandas(python)  (0) 2026.04.17
๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ - Flask  (0) 2026.03.16
๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ - Playwright  (0) 2026.03.13
'๐Ÿ“‚ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€
  • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ - Shadcn/ui
  • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ - Jupyter
  • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ - pandas(python)
  • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ - Flask
j2yonghwa
j2yonghwa
Trying to be a fullstack developer ๐Ÿš€
  • j2yonghwa
    j2yonghwa
    j2yonghwa
  • ์ „์ฒด
    ์˜ค๋Š˜
    ์–ด์ œ
    • ๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ (156)
      • โฐ Daily WakaTime (1)
      • ๐Ÿ–๏ธ ๋…ธ๋งˆ๋“œ์ฝ”๋” (2)
      • ๐Ÿบ Dev Setup (3)
      • ๐Ÿ”ญ Tech Info (1)
      • ๐Ÿšซ Error (1)
      • ๐Ÿ“‚ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ (23)
      • ♣๏ธ Next.js 14 (10)
      • ♠๏ธ Next.js 12 (20)
      • ๐Ÿ›ธ React Native (12)
      • ๐Ÿฆ‹ TypeScript (1)
      • ๐Ÿ Python (2)
      • ๐ŸŒŠ TailwindCSS (4)
      • ๐Ÿงฉ SQL (25)
      • ๐Ÿ’Ž Prisma (5)
      • ๐ŸŒฑ MongoDB (4)
      • ๐ŸŽฏ Redis (1)
      • ๐Ÿงฌ GraphQL (2)
      • ๐Ÿ”ฅ Firebase (7)
      • ๐Ÿ’ธ Third-Party Services (2)
      • ๐Ÿ•ธ๏ธ Web (1)
      • ๐Ÿ† ์ฝ”๋”ฉํ…Œ์ŠคํŠธ (23)
      • ๐Ÿ“™ ๋ชจ๋”ฅ๋‹ค (5)
      • ๐Ÿ“— ์ฝ”ํ…Œ ํ•ฉ๊ฒฉ์ž ๋˜๊ธฐ -JS- (0)
      • ๐Ÿ“˜ ํด๋ฆฐ์ฝ”๋“œ (0)
      • ๐Ÿฏ ๊ฟ€ํŒ ๐Ÿ (1)
  • ๋ธ”๋กœ๊ทธ ๋ฉ”๋‰ด

    • ํ™ˆ
    • ํƒœ๊ทธ
    • ๋ฐฉ๋ช…๋ก
  • ๋งํฌ

    • ๊นƒํ—™
  • ๊ณต์ง€์‚ฌํ•ญ

  • ์ธ๊ธฐ ๊ธ€

  • ํƒœ๊ทธ

    Next.js
    next.js 12
    next.js 14
    Firebase
    Prisma
    mongoDB
    ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ
    SQL
    dev setup
    React Native
    tailwindcss
    ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
    PostgreSQL
    react router
    ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ž…๋ฌธ
    Python
    API
    0๋ ˆ๋ฒจ
    MySQL
    ๋ชจ๋”ฅ๋‹ค
  • ์ตœ๊ทผ ๋Œ“๊ธ€

  • ์ตœ๊ทผ ๊ธ€

  • hELLOยท Designed By์ •์ƒ์šฐ.v4.10.3
j2yonghwa
๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ - plotly(python)
์ƒ๋‹จ์œผ๋กœ

ํ‹ฐ์Šคํ† ๋ฆฌํˆด๋ฐ”