Bokeh(Bokeh.js)是一个可在Python中提供交互式的可视化库,其支持Web浏览器,并提供类似于D3.js软件一样的完美展示功能。本文简单介绍如何使用该程序库绘制仪表盘图,具体操作如下:
导入命令
1)设置工作环境%cd "F:\\Dropbox\\python"
2)导入程序包import matplotlib.pyplot as plt
import numpy as np
from matplotlib.image import BboxImage
from matplotlib._png import read_png
import matplotlib.colors
from matplotlib.cbook import get_sample_data
from collections import OrderedDict
from math import log, sqrt
import numpy as np
import pandas as pd
from bokeh.plotting import figure, show, output_file
3)读取数据df =pd.read_csv("stata_auto.csv" )
4)定义参数并绘制图像drug_color = OrderedDict([
("price", "#0d3362"),
("weight", "#c64737"),
("rep78", "black" ),
])
gram_color = {