{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "\n", "# 使用PyEcharts进行可视化\n", "\n", "Visualization with PyEcharts\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Echarts\n", "\n", "https://echarts.apache.org/examples/zh/index.html\n", "\n", "- 第一步,选取图类型 \n", "- 第二步,修改图\n", "- 第三步,点击download下载html文件\n", "- 第四步,修改下载的html文件\n", "\n", "案例1:散点图\n", "https://echarts.apache.org/examples/zh/editor.html?c=bubble-gradient" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "案例2:Put echarts into a html\n", "\n", "Note: set the **height** of section.\n", "\n", "**Question**: How to add more echarts into a html?" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "案例3:读取json数据\n", "\n", "https://echarts.apache.org/examples/zh/editor.html?c=scatter-life-expectancy-timeline\n", "\n", "前端的开发的html给我们的时候,由于内部有一些ajax请求的json的数据,需要在一个web server中查看,每次放到http服务器太麻烦。还是直接用python造一个最方便。最简单的,直接用\n", "\n", "> python3 -m http.server\n", "\n", "同时,读取json数据时,需要调用jquery\n", "\n", "```\n", "\n", "```\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## pyecharts安装\n", " https://github.com/pyecharts/pyecharts\n", "\n", "> pip install pyecharts -U\n", "\n", " \n", "- pip install echarts-countries-pypkg\n", "- pip install echarts-china-provinces-pypkg\n", "- pip install echarts-china-cities-pypkg" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## pyecharts使用简介\n", "Echarts 是一个由百度开源的数据可视化,凭借着良好的交互性,精巧的图表设计,得到了众多开发者的认可。而 Python 是一门富有表达力的语言,很适合用于数据处理。当数据分析遇上数据可视化时,pyecharts 诞生了。https://pyecharts.org/#/\n", "\n", "- 配置项: 全局配置项 | 系列配置项\n", "- 基本使用: 图表 API | 示例数据 | 全局变量\n", "- 图表类型: 基本图表 | 直角坐标系图表 | 地理图表 | 3D 图表 | 组合图表 | HTML 组件\n", "- 进阶话题: 参数传递 | 数据格式 | 定制主题 | 定制地图 | 渲染图片 | Notebook | 原生 Javascript | 资源引用\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2020-05-13T09:06:10.927230Z", "start_time": "2020-05-13T09:06:10.910267Z" }, "scrolled": true, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "
\n", "\n", "\n" ], "text/plain": [ "