matplotlib 标签_matplotlib数据可视化基础设置
matplotlib數(shù)據(jù)可視化基礎(chǔ)
圖形在jupyter notebook中顯示圖形
%# 中文和負號的正常顯示
#plt.rcParams['font.sans-serif'] = ['Microsoft YaHei'] plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = Falseimport matplotlib.pyplot as plt import numpy as np import pandas as pd簡單的繪圖
data[0 1 2 3 4 5 6 7 8 9]
[<matplotlib.lines.Line2D at 0x20d9b36b860>]
線條寬度
data線條顏色
data[<matplotlib.lines.Line2D at 0x20d9c592be0>]
matplotlib支持的顏色
線型選擇
data[<matplotlib.lines.Line2D at 0x20d9c405080>]
matplotlib線型
marker選擇
data[<matplotlib.lines.Line2D at 0x20d9c4982b0>]
marker可選參數(shù):
'.'添加圖例
data<matplotlib.legend.Legend at 0x20d9c5ec9e8>
添加標題
dataText(0.5, 1.0, '簡單繪圖')
添加水平和豎直軸文字
#繪圖Text(0, 0.5, 'y')
設(shè)置繪圖風格
#繪圖Text(0, 0.5, 'y')
'seaborn-bright' ' fivethirtyeight' 'seaborn-whitegrid ' 'seaborn-dark ’ 'seaborn-talk ' 'dark_background' 'seaborn-dark-palette' 'seaborn-darkgrid' 'seaborn-white' ' classic' 'seaborn-colorblind' 'ggplot' 'grayscale' 'seaborn-paper' ' seaborn-deep' 'seaborn-pastel' 'bmh' 'seaborn-ticks' 'seaborn-notebook' 'seaborn-poster' 'seaborn-muted'
設(shè)置圖中文字
#繪圖Text(2.5, 4, '標注文字')
加箭頭
#繪圖Text(4, 8, '標注文字2')
matplotlib數(shù)據(jù)可視化簡單案例
導入庫,中文設(shè)置,圖像顯示
import導入excel表格
df #對不同地段計數(shù)龍華 436
徐家匯 380
田林 357
康健 350
衡山路 252
長橋 221
華涇 178
建國西路 162
上海南站 136
斜土路 128
徐匯濱江 126
華東理工 103
植物園 89
漕河涇 58
萬體館 15
虹梅路 9
Name: 地段, dtype: int64
<matplotlib.axes._subplots.AxesSubplot at 0x140a3c8e630>
#繪制條形圖<matplotlib.axes._subplots.AxesSubplot at 0x140a448db38>
總結(jié)
以上是生活随笔為你收集整理的matplotlib 标签_matplotlib数据可视化基础设置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python2.7显示中文_Python
- 下一篇: java二维矩阵怎么进行转置_矩阵求导的