plot - 更改颜色条热图中的中断数量 Julia

标签 plot julia heatmap plots.jl

我正在尝试更改热图图例中的中断数量。我正在使用 docs 中的示例使其可重现:

using Unitful, Plots

xs = [string("x", i) for i = 1:10]
ys = [string("y", i) for i = 1:4]
z = float((1:4) * reshape(1:10, 1, :)) * u"km"
heatmap(xs, ys, z, aspect_ratio=1)

输出:

enter image description here

假设我只需要 4 个中断,例如:5、15、25、35。我们如何更改 Julia 中热图中的中断数量?

最佳答案

您可以使用colorbar_ticks,但gr()不支持它们,因此您需要切换到pyplot()后端:

pyplot()
heatmap(xs, ys, z, aspect_ratio=1, colorbar_ticks=[5, 15, 25, 35] .* u"km")

enter image description here

关于plot - 更改颜色条热图中的中断数量 Julia,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74962765/

相关文章:

r - 在多页pdf中绘制多个ggplot(每页一个或多个图)

javascript - 这个交互式功能浏览器的 javascript 库是什么?

julia - 如何在 Julia 1.0 中安装软件包

python-3.x - 如何绘制分类特征的 Cramer’s V 热图?

javascript - 在 cesium.js 中使用 heatmap.js

r - scatter.smooth R 函数 - 颜色

r - 使用R进行分段回归:绘制线段

julia - Gadfly:绘制函数时如何设置采样点数?

julia - Julia 中 se 的所有子集

r - ggplot2:快速热图绘制、 reshape ?