17个品牌,113款5G手机,5G离我们越来越近。

时间:2022-07-27
本文章向大家介绍17个品牌,113款5G手机,5G离我们越来越近。,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

前几天iPhone12发布,苹果也终于推出它的首款5G手机。

最低价位5499元,贫穷的小F果断选择放弃,哈哈~

「澎湃美术课」也发布了一篇关于5G手机的推文。

访问地址:iPhone 12,已经是第113款5G手机了

里面对5G手机价格及芯片5G下载网速5G网络城市等相关数据进行可视化。

分析的也很有道理,所以本期就利用他们的数据,来复现一下。

三种图,象形图条形图地图,统统用Pyecharts来实现。

时隔一年,小F又和它相遇了。

之前都是用的0.5版本,目前Pyecharts的最新版本是1.8.1。

果断最新版本,又开始啃文档的旅程~

01. 各品牌5G手机价位比较

一共有17个品牌,其中realme是一个新兴的手机品牌,2018年才创立。

并且它出的一款5G手机,价格居然低至1000元

5G体验机,这个怕是抢不到手呀~

from pyecharts.charts import PictorialBar
from pyecharts import options as opts

# 品牌名称
label = ['华硕', '联想', '摩托罗拉', '魅族', '黑鲨', '努比亚', '中兴', '一加', '小米', 'IQOO', '红米', '三星', 'realme', 'OPPO', '荣耀', 'vivo', '华为']


def pic_bar_price(values, label):
    """
    5G手机价位比较
    """
    # 初始化,设置图表大小
    pictorialbar = PictorialBar(init_opts=opts.InitOpts(width='480px', height='700px'))
    # x轴标签信息
    pictorialbar.add_xaxis(label)
    # 添加象形图
    pictorialbar.add_yaxis("",
        values[0],
        symbol_size=18,
        symbol_repeat='20',
        symbol_offset=[0,0],
        is_symbol_clip=True,
        symbol='rect',
        color='#FCA46A',
        gap='-100%',
        symbol_margin=10,
        label_opts=opts.LabelOpts(is_show=False)
    )
    pictorialbar.add_yaxis("5000元及以上",
        values[1],
        symbol_size=18,
        label_opts=opts.LabelOpts(is_show=False),
        symbol_repeat='20',
        symbol_offset=[0, 0],
        is_symbol_clip=True,
        symbol='rect',
        color='#F95DBA',
        gap='-100%',
        symbol_margin=10
    )
    pictorialbar.add_yaxis("3000-4999元",
        values[2],
        label_opts=opts.LabelOpts(is_show=False),
        symbol_size=18,
        symbol_repeat='20',
        symbol_offset=[0, 0],
        is_symbol_clip=True,
        symbol='rect',
        color='#4E70F0',
        gap='-100%',
        symbol_margin=10
    )
    pictorialbar.add_yaxis("1000-2999元",
        values[3],
        yaxis_index=0,
        label_opts=opts.LabelOpts(is_show=False),
        symbol_size=18,
        symbol_repeat='20',
        symbol_offset=[0, 0],
        is_symbol_clip=True,
        symbol='rect',
        color='#1720D1',
        gap='-100%',
        symbol_margin=10
    )
    pictorialbar.add_yaxis("999元及以下",
        values[4],
        yaxis_index=0,
        label_opts=opts.LabelOpts(is_show=False),
        symbol_size=18,
        symbol_repeat='20',
        symbol_offset=[0, 0],
        is_symbol_clip=True,
        symbol='rect',
        color='white',
        gap='-100%',
        symbol_margin=10
    )
    pictorialbar.set_global_opts(
        # 隐藏x坐标轴
        xaxis_opts=opts.AxisOpts(is_show=False),
        # 显示y坐标轴,隐藏刻度线
        yaxis_opts=opts.AxisOpts(is_show=True, axistick_opts=opts.AxisTickOpts(is_show=False)),
        # 显示图例,设置图例位置
        legend_opts=opts.LegendOpts(pos_bottom='9%', pos_right='10%', orient='vertical', item_width=18, item_height=18),
        # 添加标题,设置标题位置
        title_opts=opts.TitleOpts(title='各品牌5G手机价位比较', pos_left='center', pos_top='2%')
    )
    pictorialbar.reversal_axis()
    pictorialbar.render('各品牌5G手机价位比较.html')


values = [
    [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
    [5, 10, 10, 15, 15, 15, 15, 15, 35, 35, 40, 45, 45, 50, 60, 65, 85],
    [0, 10, 5, 15, 15, 15, 15, 10, 25, 35, 40, 10, 45, 40, 60, 50, 55],
    [0, 0, 0, 0, 0, 5, 15, 5, 5, 15, 35, 10, 30, 25, 45, 30, 35],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0]
]
pic_bar_price(values, label)

使用Pyecharts的PictorialBar(象形柱状图),通过图形来表示数量。

和澎湃美术课的图表相比,排列位置是有点区别,其他相差不大。

其中一个方块代表1个数量,也就意味着荣耀品牌的5G手机有12款,小F就用的里面其中的1款~

可以看出,1000-2999元(粉色)和3000元及以上(蓝色)平分秋色。

realme售价为998元的手机也是一枝独秀。

手机芯片,主要是骁龙联发科天玑麒麟三星Exynos

from pyecharts.charts import PictorialBar
from pyecharts import options as opts

# 品牌名称
label = ['华硕', '联想', '摩托罗拉', '魅族', '黑鲨', '努比亚', '中兴', '一加', '小米', 'IQOO', '红米', '三星', 'realme', 'OPPO', '荣耀', 'vivo', '华为']


def pic_bar_microchip(values, label):
    pictorialbar=PictorialBar(init_opts=opts.InitOpts(width='480px', height='700px'))
    pictorialbar.add_xaxis(label)
    pictorialbar.add_yaxis("",
        values[0],
        symbol_size=18,
        symbol_repeat='20',
        symbol_offset=[0,0],
        is_symbol_clip=True,
        symbol='rect',
        color='#F95DBA',
        gap='-100%',
        symbol_margin=10,
        label_opts=opts.LabelOpts(is_show=False)
    )
    pictorialbar.add_yaxis("高通骁龙",
        values[1],
        symbol_size=18,
        label_opts=opts.LabelOpts(is_show=False),
        symbol_repeat='20',
        symbol_offset=[0, 0],
        is_symbol_clip=True,
        symbol='rect',
        color='#FFCE2B',
        gap='-100%',
        symbol_margin=10
    )
    pictorialbar.add_yaxis("联发科天玑/MT",
        values[2],
        label_opts=opts.LabelOpts(is_show=False),
        symbol_size=18,
        symbol_repeat='20',
        symbol_offset=[0, 0],
        is_symbol_clip=True,
        symbol='rect',
        color='#009688',
        gap='-100%',
        symbol_margin=10
    )
    pictorialbar.add_yaxis("华为麒麟",
        values[3],
        yaxis_index=0,
        label_opts=opts.LabelOpts(is_show=False),
        symbol_size=18,
        symbol_repeat='20',
        symbol_offset=[0, 0],
        is_symbol_clip=True,
        symbol='rect',
        color='#1720D1',
        gap='-100%',
        symbol_margin=10
    )
    pictorialbar.add_yaxis("三星Exynos",
        values[4],
        yaxis_index=0,
        label_opts=opts.LabelOpts(is_show=False),
        symbol_size=18,
        symbol_repeat='20',
        symbol_offset=[0, 0],
        is_symbol_clip=True,
        symbol='rect',
        color='white',
        gap='-100%',
        symbol_margin=10
    )
    pictorialbar.set_global_opts(
        xaxis_opts=opts.AxisOpts(is_show=False),
        yaxis_opts=opts.AxisOpts(is_show=True, axistick_opts=opts.AxisTickOpts(is_show=False)),
        legend_opts=opts.LegendOpts(pos_bottom='9%', pos_right='10%', orient='vertical', item_width=18, item_height=18),
        title_opts=opts.TitleOpts(title='各品牌5G手机芯片比较', pos_left='center', pos_top='2%')
    )
    pictorialbar.reversal_axis()
    pictorialbar.render('各品牌5G手机芯片比较.html')


values = [
    [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
    [5, 10, 10, 15, 15, 15, 15, 15, 35, 35, 40, 45, 45, 50, 60, 65, 85],
    [0, 0, 0, 0, 0, 0, 5, 0, 0, 5, 15, 5, 20, 15, 60, 30, 85],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 45, 25, 60],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 25, 0]
]
pic_bar_microchip(values, label)

骁龙占据了大部分的5G手机市场,麒麟和联发科不相上下。

今年5月份,美国对华为制定了全面升级的芯片禁令,麒麟的处境目前是十分艰难。

希望华为能坚持住,从上学一直到现在,小F给自己或者家里买手机,全是华为品牌,妥妥的一枚花粉~

02. 三大运营商的5G/4G速度对比

5G相较于4G,优点就是速度变得更快

这个在去年「何同学」刷爆全网的5G科普视频,也能了解一二。

小F的印象里,下载App的速度大概是80-90Mbps的样子。

from pyecharts.charts import Bar
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode

c = (
    Bar()
    # 添加类目轴文本标签
    .add_xaxis(['中 国n联 通', '中 国n电 信', '中 国n移 动'])
    # 添加数值轴,label显示及偏移,颜色渐变,定义不同类型间距(最新版本pyecharts1.8.1)
    .add_yaxis("4G", [22.84, 25.29, 26.6], itemstyle_opts=JsCode('ItemStyleOpts_4G'), label_opts=opts.LabelOpts(is_show=True, formatter=JsCode('label_4G'), position='insideRight', color='black', font_weight='bolder', distance=0, font_size=14), category_gap='70%', gap='20%')
    .add_yaxis("5G", [160.04, 168.39, 284.37], itemstyle_opts=JsCode('ItemStyleOpts_5G'), label_opts=opts.LabelOpts(is_show=True, formatter=JsCode('label_5G'), position='insideRight', color='black', font_weight='bolder', distance=0, font_size=14), category_gap='70%', gap='20%')
    # x/y轴互换位置
    .reversal_axis()
    .set_global_opts(
        # 标题设置
        title_opts=opts.TitleOpts(title='三大运营商的5G/4G速度对比', subtitle='下载网速对比(单位:Mbps)', pos_left='center', pos_top='-1%', item_gap=3),
        # 隐藏图例
        legend_opts=opts.LegendOpts(is_show=False),
        # x轴属性设置,隐藏刻度线和坐标轴,设置分割线(虚线)
        xaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(is_show=True, position='10%'),
                                 position='top',
                                 axistick_opts=opts.AxisTickOpts(is_show=False),
                                 axisline_opts=opts.AxisLineOpts(is_show=False),
                                 splitline_opts=opts.SplitLineOpts(is_show=True, linestyle_opts=opts.LineStyleOpts(width=1, opacity=0.5, type_='dotted', color='grey'))
        ),
        # y轴属性设置,隐藏刻度线
        yaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(is_show=True, font_size=15, font_weight='normal'), axistick_opts=opts.AxisTickOpts(is_show=False)),

    )
    # 添加标签函数及颜色函数
    .add_js_funcs(
        """
        const label_4G = function(arg) {
            console.log(arg)
            if (arg.data === 26.6) {
                return '4G▐'
            }
            else {
                return '▐'
            }
        }

        const label_5G = function(arg) {
            //console.log(arg)
            if (arg.data === 284.37) {
                return '5G▐'
            }
            else {
                return '▐'
            }
        }

        const ItemStyleOpts_4G = {'color': function(arg) {
            return new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                {
                    offset: 0.01,
                    color: "black",
                },
                {
                    offset: 0.018,
                    color: "white",
                },
                {
                    offset: 1,
                    color: '#F7A1AC',
                }
            ])
        }}

        const ItemStyleOpts_5G = {'color': function(arg) {
            return new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                {
                    offset: 0.001,
                    color: "black",
                },
                {
                    offset: 0.003,
                    color: "white",
                },
                {
                    offset: 1,
                    color: '#4E70F0',
                }
            ])
        }}
        """
    )
    .render("三大运营商的速度对比.html")
)

这里通过Pyecharts的add_js_funcs函数,传入原生的JS函数。

如此便可自定义标签文本信息,以及柱状图添加渐变颜色

修改Y轴数据,即可得到上传网速对比图表。

可以看到5G的下载网速快要到4G的10倍了。

不过话又说回来了,5G好是好,就是套餐太贵了。

前几天电信还发短信,邀请小F升级5G。

来看一下5G套餐的具体情况。

129元没有宽带,而且流量只有30G。

对于5G那样的下载速度,感觉流量根本不够用呀!

03. 5G商用网络城市

这个名单是在去年公布的,三大运营商,涵盖了55个城市。

各大运营商5G商用城市名单如下。

# 电信5G商用城市名单
Telecom = '北京、天津、上海、重庆、石家庄、保定、太原、晋城、呼和浩特、沈阳、大连、长春、哈尔滨、南京、无锡、苏州、杭州、宁波、温州、嘉兴、合肥、芜湖、福州、厦门、泉州、南昌、鹰潭、济南、青岛、郑州、南阳、武汉、长沙、株洲、广州、深圳、佛山、东莞、南宁、柳州、海口、琼海、成都、贵阳、昆明、西安、兰州、西宁、银川、乌鲁木齐'

# 移动5G商用城市名单
Mobile = '北京、天津、上海、重庆、石家庄、保定、太原、晋城、呼和浩特、沈阳、大连、长春、哈尔滨、南京、无锡、苏州、杭州、宁波、温州、嘉兴、合肥、芜湖、福州、厦门、泉州、南昌、鹰潭、济南、青岛、郑州、南阳、武汉、长沙、株洲、广州、深圳、佛山、东莞、柳州、南宁、海口、琼海、成都、贵阳、昆明、西安、兰州、西宁、银川、乌鲁木齐、'

# 移动5G商用城市名单
Unicom = '北京、上海、广州、深圳、杭州、南京、天津、武汉、济南、郑州、苏州、青岛、重庆、成都、宁波、温州、嘉兴、绍兴、东莞、佛山、中山、珠海、无锡、常州、南通、沈阳、长沙、大连、兰州、福州、石家庄、太原、西宁、西安、厦门、贵阳、保定、呼和浩特、南宁、海口、哈尔滨、南昌、合肥、银川、昆明、长春、泉州、柳州、鹰潭、乌鲁木齐、'

小F的老家没上榜,工作的地方上榜了。

打开手机的5G开关,是有5G信号的,但是没有开通5G套餐,也没啥用~

from pyecharts.commons.utils import JsCode
from pyecharts import options as opts
from pyecharts.charts import Geo
from collections import Counter

# 电信5G商用城市名单
Telecom = '北京、天津、上海、重庆、石家庄、保定、太原、晋城、呼和浩特、沈阳、大连、长春、哈尔滨、南京、无锡、苏州、杭州、宁波、温州、嘉兴、合肥、芜湖、福州、厦门、泉州、南昌、鹰潭、济南、青岛、郑州、南阳、武汉、长沙、株洲、广州、深圳、佛山、东莞、南宁、柳州、海口、琼海、成都、贵阳、昆明、西安、兰州、西宁、银川、乌鲁木齐'
# 移动5G商用城市名单
Mobile = '北京、天津、上海、重庆、石家庄、保定、太原、晋城、呼和浩特、沈阳、大连、长春、哈尔滨、南京、无锡、苏州、杭州、宁波、温州、嘉兴、合肥、芜湖、福州、厦门、泉州、南昌、鹰潭、济南、青岛、郑州、南阳、武汉、长沙、株洲、广州、深圳、佛山、东莞、柳州、南宁、海口、琼海、成都、贵阳、昆明、西安、兰州、西宁、银川、乌鲁木齐、'
# 移动5G商用城市名单
Unicom = '北京、上海、广州、深圳、杭州、南京、天津、武汉、济南、郑州、苏州、青岛、重庆、成都、宁波、温州、嘉兴、绍兴、东莞、佛山、中山、珠海、无锡、常州、南通、沈阳、长沙、大连、兰州、福州、石家庄、太原、西宁、西安、厦门、贵阳、保定、呼和浩特、南宁、海口、哈尔滨、南昌、合肥、银川、昆明、长春、泉州、柳州、鹰潭、乌鲁木齐、'

# 处理数据,拼接-分割
mStr = Mobile + Unicom + Telecom
mStr = mStr.split("、")

# 城市计数
citys = []
counts = Counter(mStr)
for i, j in zip(counts, counts.values()):
    citys.append((i, j))
print(citys)

# 生成地图
c = (
    Geo()
    .add_schema(maptype="china")
    .add("geo", citys, symbol_size=6)
    .set_series_opts(
        # 自定义标签(显示)
        label_opts=opts.LabelOpts(
            formatter=JsCode(
                """
                function(x){
                    console.log(x);
                    if (['福州', '乌鲁木齐', '呼和浩特', '银川', '西宁', '兰州', '成都', '贵阳', '昆明', '南宁', '海口', '长沙', '南昌', '武汉', '合肥', '郑州', '济南', '太原', '石家庄', '天津', '北京', '大连', '沈阳', '长春', '哈尔滨'].indexOf(x.data.name) > -1) {
                        return x.data.name
                    }
                    else {
                        return ''
                    }
                }
                """
            ),
            color='black'
        )
    )
    .set_global_opts(
        # 视觉映射配置,分段型
        visualmap_opts=opts.VisualMapOpts(is_show=True, is_piecewise=True, pieces=[{"value": 1, "color": '#F95DBA', "label": '1个运营商支持', "symbol": 'circle', "symbolSize": 6}, {"value": 2, "color": '#A64DFF', "label": '2个运营商支持', "symbol": 'circle', "symbolSize": 6}, {"value": 3, "color": '#4E70F0', "label": '3个运营商支持', "symbol": 'circle', "symbolSize": 6}], pos_left='22%', pos_bottom='7%'),
        # 图表标题及副标题
        title_opts=opts.TitleOpts(title="目前提供5G商用网络的城市", subtitle='数据来源:电信、移动、联通官方发布', pos_left='center', pos_top='-1%', item_gap=5),
        # 隐藏图例
        legend_opts=opts.LegendOpts(is_show=False),
        # 添加多个文本
        graphic_opts=[
            opts.GraphicGroup(
                graphic_item=opts.GraphicItem(left='68%', top='52%', z=99),
                children=[
                    opts.GraphicText(
                        graphic_item=opts.GraphicItem(left='68%', top='52%', z=100),
                        graphic_textstyle_opts=opts.GraphicTextStyleOpts(
                            text='江浙沪共10n个城市拥有n商用5G网络',
                            font='bolder 14px Microsoft YaHei',
                            graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(fill="black"))
                    )
                ],
            ),
            opts.GraphicGroup(
                graphic_item=opts.GraphicItem(left='68%', top='61%', z=99),
                children=[
                    opts.GraphicText(
                        graphic_item=opts.GraphicItem(left='68%', top='61%', z=100),
                        graphic_textstyle_opts=opts.GraphicTextStyleOpts(
                            text='上海 杭州 南京n苏州 无锡 南通 常州n宁波 温州 嘉兴 绍兴',
                            font='lighter 12px Microsoft YaHei',
                            graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(fill="black"))
                    )
                ],
            ),
            opts.GraphicGroup(
                graphic_item=opts.GraphicItem(left='58%', top='84%', z=99),
                children=[
                    opts.GraphicText(
                        graphic_item=opts.GraphicItem(left='58%', top='84%', z=100),
                        graphic_textstyle_opts=opts.GraphicTextStyleOpts(
                            text='广东5G商用城市n最多(6个)',
                            font='bolder 14px Microsoft YaHei',
                            graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(fill="black"))
                    )
                ],
            ),
            opts.GraphicGroup(
                graphic_item=opts.GraphicItem(left='58%', top='90%', z=99),
                children=[
                    opts.GraphicText(
                        graphic_item=opts.GraphicItem(z=100),
                        graphic_textstyle_opts=opts.GraphicTextStyleOpts(
                            text='广州 深圳 佛山 东莞 中山 珠海',
                            font='lighter 12px Microsoft YaHei',
                            graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(fill="black"))
                    )
                ],
            ),
            opts.GraphicGroup(
                graphic_item=opts.GraphicItem(left='23%', top='63%', z=99),
                children=[
                    opts.GraphicText(
                        graphic_item=opts.GraphicItem(z=100),
                        graphic_textstyle_opts=opts.GraphicTextStyleOpts(
                            text='西藏是目前唯一没有n商用网络的省份',
                            font='bolder 14px Microsoft YaHei',
                            graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(fill="black"))
                    )
                ]
            )
        ]
    )
    .render("目前提供5G商用网络的城市.html")
)

这里可以看到,通过JsCode函数,也能直接添加JS代码。

其中JS代码的作用是只显示一部分标签的信息,毕竟55个城市名全显示在地图上,会显得有些杂乱。

GraphicGroup函数是Pyecharts的原生图形元素组件,可以通过它在图表里添加文本图片等元素。

此处小F添加了5段文本,并且定义文本位置及样式。

从地图上看,55座城市,大部分分布在省会、直辖市以及长三角、珠三角。

期待以后能够有越来越多的城市提供5G网络,同时降低5G套餐价格。

代码我已上传公众号,回复「5G」即可获取

也可直接点击https://github.com/Tobby-star/5G_Visualization

,直接访问我的GitHub~