zoukankan      html  css  js  c++  java
  • matplotlib多plot可视化

    代码:

     1 # -*- coding: utf-8 -*-
     2 """
     3 Created on Thu Jul 12 16:37:47 2018
     4 
     5 @author: zhen
     6 """
     7 """
     8     分块展示,包括:线图,柱状图,箱线图,点图
     9 """
    10 from matplotlib.pyplot import *
    11 
    12 x = [1, 2, 3, 4]
    13 y = [5, 4, 3, 2]
    14 
    15 # create new figure
    16 figure()
    17 
    18 # divide subplots into 2 * 3 grid
    19 # and select #1
    20 
    21 subplot(231)
    22 plot(x, y)
    23 
    24 # select #2
    25 subplot(232)
    26 bar(x, y)
    27 
    28 # horizontal bar-charts
    29 subplot(233)
    30 barh(x, y)
    31 
    32 # create stacked bar charts
    33 subplot(234)
    34 bar(x, y)
    35 
    36 # we need more data for stacked bar charts
    37 y1 = [7, 8, 5, 3]
    38 bar(x, y1, bottom=y, color='r')
    39 
    40 # box plot
    41 subplot(235)
    42 boxplot(x)
    43 
    44 # scatter plot
    45 subplot(236)
    46 scatter(x, y)
    47 
    48 show()

    结果:

  • 相关阅读:
    [ext4]空间管理
    [ext4] 磁盘布局
    [ext4]磁盘布局
    [ext4]08 磁盘布局
    [ext4]07 磁盘布局
    [ext4]06 磁盘布局
    [ext4]05 磁盘布局
    jQuery之链式编程
    jQuery之排他思想
    jQuery之筛选方法
  • 原文地址:https://www.cnblogs.com/yszd/p/9303865.html
Copyright © 2011-2022 走看看