http://bokeh.pydata.org/en/latest/docs/user_guide/plotting.html

创建画板

scatter图

from bokeh.plotting import figure, output_file, show
# 输出静态html图
output_file("line.html")
p = figure(plot_width=400, plot_height=400)
# 添加园渲染,设置大小,颜色,透明度
p.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)
# 展示结果
show(p)

line图

from bokeh.plotting import figure, output_file, show
output_file("line.html")
p = figure(plot_width=400, plot_height=400)
# 添加线渲染
p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2)
show(p)

多线图可以使用figure.multi_line

Bars和Rectangles图

Rectangles

from bokeh.plotting import figure, show, output_file
output_file('rectangles.html')
p = figure(plot_width=400, plot_height=400)
p.quad(top=[2, 3, 4], bottom=[1, 2, 3], left=[1, 2, 3],right=[1.2, 2.5, 3.7], color="#B3DE69")# 设置长方形四个点的位置
show(p)

可以使用rect()来画任意角度的长方形

Bars

from bokeh.plotting import figure, show, output_file
output_file('vbar.html')
p = figure(plot_width=400, plot_height=400)
p.vbar(x=[1, 2, 3], width=0.5, bottom=0,top=[1.2, 2.5, 3.7], color="firebrick") # 设置刻度宽度
show(p)

使用hbar绘制水平条形图

Patch图

from bokeh.plotting import figure, output_file, show
output_file("patch.html")
p = figure(plot_width=400, plot_height=400)# add a patch renderer with an alpha an line width
p.patch([1, 2, 3, 4, 5], [6, 7, 8, 7, 3], alpha=0.5, line_width=2) # 设置每个定点的位置
show(p)

使用patches()绘制多个patch图

Ovals and Ellipses图

from math import pi
from bokeh.plotting import figure, show, output_fileoutput_file('ovals.html')p = figure(plot_width=400, plot_height=400)
p.oval(x=[1, 2, 3], y=[1, 2, 3], width=0.2, height=40, color="#CAB2D6",angle=pi/3, height_units="screen")show(p)

Images

from __future__ import divisionimport numpy as npfrom bokeh.plotting import figure, output_file, show# create an array of RGBA data
N = 20
img = np.empty((N, N), dtype=np.uint32)
view = img.view(dtype=np.uint8).reshape((N, N, 4))
for i in range(N):for j in range(N):view[i, j, 0] = int(255 * i / N)view[i, j, 1] = 158view[i, j, 2] = int(255 * j / N)view[i, j, 3] = 255output_file("image_rgba.html")p = figure(plot_width=400, plot_height=400, x_range=(0, 10), y_range=(0, 10))p.image_rgba(image=[img], x=[0], y=[0], dw=[10], dh=[10])show(p)

Segments and Rays(线段和射线)

from bokeh.plotting import figure, showp = figure(plot_width=400, plot_height=400)
p.segment(x0=[1, 2, 3], y0=[1, 2, 3], x1=[1.2, 2.4, 3.1],y1=[1.2, 2.5, 3.7], color="#F4A582", line_width=3)show(p)

Wedges and Arcs(契形和弧度)

from bokeh.plotting import figure, showp = figure(plot_width=400, plot_height=400)
p.arc(x=[1, 2, 3], y=[1, 2, 3], radius=0.1, start_angle=0.4, end_angle=4.8, color="navy")show(p)

多种图形

设置坐标轴范围

from bokeh.plotting import figure, output_file, show
from bokeh.models import Range1doutput_file("title.html")# create a new plot with a range set with a tuple
p = figure(plot_width=400, plot_height=400, x_range=(0, 20))# set a range using a Range1d
p.y_range = Range1d(0, 15)p.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)show(p)

设置坐标类型

Categorical Axes

Datetime Axes

Log Scale Axes

Twin Axes

Annotations(注释)

Bokeh 使用Basic Glyphs做图相关推荐

  1. 影像组学视频学习笔记(14)-特征权重做图及美化、Li‘s have a solution and plan.

    本笔记来源于B站Up主: 有Li 的影像组学系列教学视频 本节(14)主要介绍: 特征权重做图及美化 import matplotlib.pyplot as plt %matplotlib inlin ...

  2. 分屏显示_王者做图显示器,戴尔(DELL)U2417全面介绍

    戴尔U系列显示器是多年以来很多做图人的必选显示器,今天徐先生就给大家分享一下戴尔U系列显示器的全面数据,提供给大家参考.有兴趣的小伙伴可以选择观看阅读,读完给点个关注呗! 全景窄边框24英寸显示器 U ...

  3. 总奖金40万元,图神经网络赛道baseline发布!教你用DGL做图任务

    本文为2021 MAXP 系列公开课第二讲完整版直播回顾,由亚马逊云科技上海人工智能研究院张建博士主讲.介绍了图机器学习任务的概况,并着重讲解了本次大赛的图机器学习赛题,文中附基线模型开源地址. 在过 ...

  4. 直接用自己服务器做图床可以吗_我花 9 块钱搭了一个“私人图床”

    背景 之前一直把简书当做自己的私人"图床"来用,因为简书的Markdown编辑器非常稳定,实时保存加图片ctrl+v复制进去就能用的特征让我一直坚持在简书上首发自己写的东西,然后图 ...

  5. 完美的做图配色专辑,UI设计师赶紧收藏

    UI视觉配色是一门至关重要的功课! 视觉层次的一致性 1.选择想要使用的配色(想想使用柔和的粉彩构成的背景主色调,搭配一个给人精致感的次要色,以及一个抓人注意力的强调色.) 2.选择合理的字体(我用的 ...

  6. Pandas.plot 做图

    Series Series.plot(kind='line', ax=None, figsize=None, use_index=True, title=None, grid=None, legend ...

  7. python画图turtle小人_python海龟绘图怎么增加每次画圆的半径|海龟python做图教程...

    在python的海龟作图中怎么取一个图形的对称图形 用坐标法吧,turtle默认的初始位置是(0,0),用penup(),goto(),pendown()移动到某个位置,自己算一下就可以.然后,用st ...

  8. 渲图买桌面CPU还是服务器cpu,做图用什么显卡好,图形渲染CPU重要还是显卡重要...

    做图用什么显卡好,图形渲染CPU重要还是显卡重要 发布时间:2018-09-15 09:19 来源:互联网 当前栏目:电脑教程 群里有朋友向笔者咨询过关于专业图形设计的电脑配置,其实对于图形设计来说主 ...

  9. 海龟作图python小猪佩奇_python海龟做图20秒完成小猪佩奇,附源码!

    Python(发音:英[?pa?θ?n],美[?pa?θɑ:n]),是一种面向对象.直译式电脑编程语言,也是一种功能强大的通用型语言,已经具备近二十年的发展历史,成熟且稳定.它包含了一组完善并且容易理 ...

最新文章

  1. GPT-3 再更新,新增编辑和插入文本功能,简直不要太好用!
  2. emqx配置mysql认证_emqx使用mysql完成用户密码验证和ACL鉴权-Go语言中文社区
  3. Triangular Pastures (二维01背包)
  4. Windows驱动开发学习笔记(六)—— Inline HOOK
  5. 量子计算机新科技未来,能够“预测多个未来”的量子计算机诞生
  6. JavaScript动画:offset和匀速动画详解(含轮播图的实现)
  7. [零基础,全开源]基于web的远程深度学习服务搭建
  8. 谷歌浏览器之如何调试页面js
  9. 【转】详解Windows消息分类以及WM_COMMAND与WM_NOTIFY的区别,以及模拟发送控件通知消息
  10. 弄潮儿数据_SINX 信息数据的“弄潮儿”
  11. CodeForces 598A Tricky Sum
  12. android dns 测试工具,DNS Test测速工具
  13. matlab采样率为100hz,matlab自己设计一个低通滤波器,要求滤出100Hz之外的频率,采样率为10000Hz...
  14. Android Studio开发(六)短距离无线通信——蓝牙通信
  15. 可以免费打电话的网站
  16. 写给程序员看的面向对象摄影技巧
  17. 什么是自动化运维?为什么选择Python做自动化运维?
  18. 百度交易中台之钱包系统架构浅析
  19. python类不支持多继承_关于Python类的多继承中的MOR继承顺序问题
  20. Git 个人学习笔记及心得

热门文章

  1. alsa 放的声音和录制的声音之间的延时_webrtc视频录制总结
  2. net.conn read 判断数据读取完毕_单方验方|如何应对千万级工商数据抓取(一)
  3. 请求转发和重定向的区别_WEB之重定向和请求转发的区别
  4. 服务器位置控制怎么找原点,伺服控制为什么要进行原点回归?怎样实现原点回归?...
  5. 管理后台--1.创建分类
  6. android电视原理图,电视机工作原理
  7. python数据结构 树_python 数据结构四 之 二叉树和树
  8. 小杜机器人线下店_打通线上线下渠道 九号机器人新零售模式成型
  9. C++之指针探究(十九):typedef和const指针
  10. aee快递查询 在php_第48课 thinkphp5添加商品库