在 Bokeh 中调整 matplotlib 标记大小?
Adjust matplotlib marker size in Bokeh?
我在看这个 matplotlib 散点图示例:
https://matplotlib.org/examples/shapes_and_collections/scatter_demo.html
"""
Simple demo of a scatter plot.
"""
import numpy as np
import matplotlib.pyplot as plt
N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radii
plt.scatter(x, y, s=area, c=colors, alpha=0.5)
plt.show()
它生成这个数字:
我试图通过利用 matplotlib 在 Bokeh 中完成同样的事情:
import numpy as np
import matplotlib.pyplot as plt
from bokeh.plotting import output_file, show
from bokeh import mpl
N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radii
plt.scatter(x, y, s=area, c=colors, alpha=0.5)
output_file("scatter_demo.html")
show(mpl.to_bokeh())
但它生成了这个数字:
如何调整圆的半径?我确信它可以用纯 Bokeh 来完成,但我希望用依赖于 Matplotlib 的 Bokeh 做一个更高级的绘图,所以我想使用 show(mpl.to_bokeh())
。谢谢!
当 运行 Bokeh 脚本时,我也收到此警告:
/Users/tc9/lib/python3.6/site-packages/bokeh/core/compat/bokeh_renderer.py:263: UserWarning: Path marker shapes currently not handled, defaulting to Circle
warnings.warn("Path marker shapes currently not handled, defaulting to Circle")
/Users/tc9/lib/python3.6/site-packages/matplotlib/artist.py:233: MatplotlibDeprecationWarning: get_axes has been deprecated in mpl 1.5, please use the
axes property. A removal date has not been set.
stacklevel=1)
编辑:等效的散点图散景演示示例如下:
http://docs.bokeh.org/en/latest/docs/gallery/color_scatter.html
它产生这个数字:
我不得不通知您,从 Bokeh 0.12.5
(将于本周晚些时候发布)开始,Bokeh 的 MPL 兼容支持将被完全弃用。它将在 Bokeh 1.0 之际被完全删除,并且在此期间不会收到任何更新(与它相关的所有示例和文档也将被删除)。
有可能在未来严格和标准化的 MPL JSON 标准将使新的独立项目能够以可维护的方式提供此功能。
我在看这个 matplotlib 散点图示例: https://matplotlib.org/examples/shapes_and_collections/scatter_demo.html
"""
Simple demo of a scatter plot.
"""
import numpy as np
import matplotlib.pyplot as plt
N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radii
plt.scatter(x, y, s=area, c=colors, alpha=0.5)
plt.show()
它生成这个数字:
我试图通过利用 matplotlib 在 Bokeh 中完成同样的事情:
import numpy as np
import matplotlib.pyplot as plt
from bokeh.plotting import output_file, show
from bokeh import mpl
N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radii
plt.scatter(x, y, s=area, c=colors, alpha=0.5)
output_file("scatter_demo.html")
show(mpl.to_bokeh())
但它生成了这个数字:
如何调整圆的半径?我确信它可以用纯 Bokeh 来完成,但我希望用依赖于 Matplotlib 的 Bokeh 做一个更高级的绘图,所以我想使用 show(mpl.to_bokeh())
。谢谢!
当 运行 Bokeh 脚本时,我也收到此警告:
/Users/tc9/lib/python3.6/site-packages/bokeh/core/compat/bokeh_renderer.py:263: UserWarning: Path marker shapes currently not handled, defaulting to Circle
warnings.warn("Path marker shapes currently not handled, defaulting to Circle")
/Users/tc9/lib/python3.6/site-packages/matplotlib/artist.py:233: MatplotlibDeprecationWarning: get_axes has been deprecated in mpl 1.5, please use the
axes property. A removal date has not been set.
stacklevel=1)
编辑:等效的散点图散景演示示例如下: http://docs.bokeh.org/en/latest/docs/gallery/color_scatter.html
它产生这个数字:
我不得不通知您,从 Bokeh 0.12.5
(将于本周晚些时候发布)开始,Bokeh 的 MPL 兼容支持将被完全弃用。它将在 Bokeh 1.0 之际被完全删除,并且在此期间不会收到任何更新(与它相关的所有示例和文档也将被删除)。
有可能在未来严格和标准化的 MPL JSON 标准将使新的独立项目能够以可维护的方式提供此功能。