vault backup: 2025-03-04 11:17:00
This commit is contained in:
34
20.01. Programming/Python/Plotly.md
Normal file
34
20.01. Programming/Python/Plotly.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
tags:
|
||||
aliases:
|
||||
date: 2024-11-10
|
||||
time: 16:58:43
|
||||
description:
|
||||
---
|
||||
|
||||
**可以用來代替[Matplotlib](https://matplotlib.org/)**
|
||||
|
||||
Yes, `Matplotlib` is classic-it’s virtually the standard to go to when it comes to visualizing data in Python. But to be frank, it feels so much like trying to use an axe for delicate brain surgery, and its syntax? A little verbose, if we’re being honest. If you’re not creating highly customized visualizations, there are better options with a more straightforward syntax.
|
||||
|
||||
## Why [Matplotlib](https://matplotlib.org/) is Overrated:
|
||||
|
||||
**Clunky syntax**: Even simple charts take an amazingly large number of lines to plot sometimes.
|
||||
|
||||
**Outdated default style:** The default style is configurable, but it isn’t exactly inspiring-or, for that matter, particularly readable.
|
||||
|
||||
## What You Should Replace It With: Plotly
|
||||
|
||||
Where visualization cleanliness and interactivity matter, and definitely don’t want a pile of code, `Plotly` is great. This is especially useful when you have to share visuals fast or within presentations on the web.
|
||||
|
||||
```python
|
||||
import plotly.express as px
|
||||
|
||||
df = px.data.iris()
|
||||
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species")
|
||||
fig.show()
|
||||
```
|
||||
|
||||
With `Ploty`, you immediately get interactive graphs with great default visuals. The code is more concise and, by default, includes things like tooltips and zooming.
|
||||
|
||||
# 參考來源
|
||||
- [5 Overrated Python Libraries (And What You Should Use Instead) | by Abdur Rahman | Nov, 2024 | Python in Plain English](https://python.plainenglish.io/5-overrated-python-libraries-and-what-you-should-use-instead-106bd9ded180)
|
||||
Reference in New Issue
Block a user