| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 |
- AS
- train/test
- line width
- matplotlib
- pie charts
- Text mining
- Else
- Default X points
- MySQL
- PANDAS
- PROJECT
- For loops
- start exercise
- Text Analytics
- line color
- machine learning
- break
- Github
- continue
- Python
- iterates
- __init__
- self parameter
- SQL
- polynomial regression
- data distribution
- matplotlib.pyplot
- multiple lines
- variables
- error
- Today
- Total
목록matplotlib (6)
Data Science Explorer
Creating Pie Charts You can use the pie() function to draw pie charts Example import matplotlib.pyplot as plt import numpy as np y = np.array ([3, 6, 7, 1]) plt.pie(y) plt.show() Result Labels The label parameter must be an array with one label for each wedge. import matplotlib.pyplot as plt import numpy as np y = np.array([35, 25, 25, 15]) mylabels = ["Apples", "Bananas", "Cherries", "Dates"] p..
A histogram is a graph showing frequency districutions. We use the hist() function to create histogram. It will use an array of numbers to create historgram. Example import matplotlib.pyplot as plt import numpy as np x = np.random.normal(50, 10, 250) plt.hist(x) plt.show() Result
Creating bars Use bar() function to draw the bar graph. Example import matplotlib.pyplot as plt import numpy as np x = np.array(["Grace", "Momo", "Anas", "David"]) y = np.array([3, 8, 1, 10]) plt.bar(x,y) plt.show() Result Horizontal bars Use barh() to have your graph displayed horizontally. Example import matplotlib.pyplot as plt import numpy as np x = np.array(["A", "B", "C", "D"]) y = np.arra..
Creating Scatter Plots You can use the scatter() function to draw a scatter plot. Example import matplotlib.pyplot as plt import numpy as np x = np.array([1, 4, 6, 2]) y = np.array([4, 5, 2, 1]) plt.scatter(x, y) plt.show() Result Compare plots Example import matplotlib.pyplot as plt import numpy as np #day one, the age and speed of 13 cars: x = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6]) y = np.ar..
Pyplot Most of the Matplotlib utilies lies under the pyplot submodule, and are usually imported under the plt alias: import matplotlib.pyplot as plt Example Draw a line in a diagram from position (0,0) to position (5, 10). import matplotlib.pyplot as plt import numpy as np xpoints = np.array([0,5]) ypoints = np.array([0,10]) plt.plot (xpoints, ypoints) plt.show() Result
What is Matplotlib? It is a low level graph plotting library in python that serves as a visualization utility. Let's get started with installation of Matplotlib. pip install matplotlib Import Matplotlib import matplotlib Check Matplotlib Version import matplotlib print (matplotlib.__version__)