AnyMath 文档

[医]条形图

该页面正在翻译中。

barplot(positions, heights; kwargs...)

绘制条形图。

绘图类型

绘图类型别名 [医]条形图 功能是 [医]条形图.

例子:

</无翻译>

using CairoMakie
f = Figure()
Axis(f[1, 1])

xs = 1:0.2:10
ys = 0.5 .* sin.(xs)

barplot!(xs, ys, color = :red, strokecolor = :black, strokewidth = 1)
barplot!(xs, ys .- 1, fillto = -1, color = xs, strokecolor = :black, strokewidth = 1)

f
1a42047

</无翻译>

using CairoMakie
xs = 1:0.2:10
ys = 0.5 .* sin.(xs)

barplot(xs, ys, gap = 0, color = :gray85, strokecolor = :black, strokewidth = 1)
d98c312

</无翻译>

using CairoMakie
tbl = (cat = [1, 1, 1, 2, 2, 2, 3, 3, 3],
       height = 0.1:0.1:0.9,
       grp = [1, 2, 3, 1, 2, 3, 1, 2, 3],
       grp1 = [1, 2, 2, 1, 1, 2, 1, 1, 2],
       grp2 = [1, 1, 2, 1, 2, 1, 1, 2, 1]
       )

barplot(tbl.cat, tbl.height,
        stack = tbl.grp,
        color = tbl.grp,
        axis = (xticks = (1:3, ["left", "middle", "right"]),
                title = "Stacked bars"),
        )
15fd82e

</无翻译>

barplot(tbl.cat, tbl.height,
        dodge = tbl.grp,
        color = tbl.grp,
        axis = (xticks = (1:3, ["left", "middle", "right"]),
                title = "Dodged bars"),
        )
4678700

</无翻译>

barplot(tbl.cat, tbl.height,
        dodge = tbl.grp1,
        stack = tbl.grp2,
        color = tbl.grp,
        axis = (xticks = (1:3, ["left", "middle", "right"]),
                title = "Dodged and stacked bars"),
        )
6789de9

</无翻译>

colors = Makie.wong_colors()

#图和轴
图=图()
ax=Axis(图[1,1],xticks=(1:3,["左","中","右"]),
        标题="躲避酒吧与传奇")

#剧情
巴普洛!(斧,tbl.cat,tbl。身高,
        道奇=tbl。grp,
        颜色=颜色[tbl。grp])

#传奇
标签=["第1组"、"第2组"、"第3组"]
elements=[PolyElement(polycolor=colors[i])for i in1:length(labels)]
标题="组"

图例(图[1,2],元素,标签,标题)

无花果
c3f92c7

</无翻译>

barplot(
    tbl.cat, tbl.height,
    dodge = tbl.grp,
    color = tbl.grp,
    bar_labels = :y,
    axis = (xticks = (1:3, ["left", "middle", "right"]),
            title = "Dodged bars horizontal with labels"),
    colormap = [:red, :green, :blue],
    color_over_background=:red,
    color_over_bar=:white,
    flip_labels_at=0.85,
    direction=:x,
)
8818bff

</无翻译>

using CairoMakie
barplot([-1, -0.5, 0.5, 1],
    bar_labels = :y,
    axis = (title="Fonts + flip_labels_at",),
    label_size = 20,
    flip_labels_at=(-0.8, 0.8),
    label_color=[:white, :green, :black, :white],
    label_formatter = x-> "Flip at $(x)?",
    label_offset = 10
)
5b98cbb

</无翻译>

using CairoMakie
gantt = (
    machine = [1, 2, 1, 2],
    job = [1, 1, 2, 3],
    task = [1, 2, 3, 3],
    start = [1, 3, 3.5, 5],
    stop = [3, 4, 5, 6]
)

fig = Figure()
ax = Axis(
    fig[2,1],
    yticks = (1:2, ["A","B"]),
    ylabel = "Machine",
    xlabel = "Time"
)
xlims!(ax, 0, maximum(gantt.stop))

cmap = Makie.to_colormap(:tab10)

barplot!(
    gantt.machine,
    gantt.stop,
    fillto = gantt.start,
    direction = :x,
    color = gantt.job,
    colormap = cmap,
    colorrange = (1, length(cmap)),
    gap = 0.5,
    bar_labels = ["task #$i" for i in gantt.task],
    label_position = :center,
    label_color = :white,
    label = ["job #$i" => (; color = i) for i in unique(gantt.job)]
)

Legend(fig[1,1], ax, "Jobs", orientation=:horizontal, tellwidth = false, tellheight = true)

fig
31ecba8

属性

阿尔法

默认值为 1.0

Colormap或color属性的alpha值。 多个阿尔法像在 图(alpha=0.2,颜色=(:红色,0.5),会成倍增加。

酒吧,酒吧

默认值为 什么都没有

在每个栏的末尾添加标签。

夹式飞机

默认值为 自动的

剪辑平面提供了一种在3D空间中进行剪辑的方法。 您可以设置最多8个向量 平面3f 飞机在这里,后面的情节将被裁剪(即变得不可见)。 默认情况下,剪辑平面继承自父绘图或场景。 您可以删除父 夹片机 通过传递 平面3f[].

颜色

默认值为 @继承patchcolor

没有可用的文档。

颜色_复盖_background

默认值为 自动的

没有可用的文档。

颜色_over_bar

默认值为 自动的

没有可用的文档。

颜色表

默认值为 @继承colormap:viridis

设置为数字采样的颜色表 颜色s. PlotUtils.cgrad(。..), 麦琪反向(any_colormap) 也可以使用,或者来自ColorBrewer或PlotUtils的任何符号。 要查看所有可用的颜色渐变,您可以调用 麦琪可用_gradients().

颜色变化

默认值为 自动的

表示的开始点和结束点的值 颜色表.

色阶;色阶

默认值为 身份认同

的颜色变换功能。 可以是任何函数,但只能与 颜色栏身份认同, 日志, 日志2, 日志10, sqrt,sqrt, 罗吉特, 麦琪伪科学10麦琪符号10.

周期

默认值为 [:颜色=>:补丁颜色]

没有可用的文档。

depth_换档

默认值为 0.0

在所有其他变换之后(即在剪辑空间中)调整绘图的深度值,其中 0<=深度<=1. 这仅适用于GLMakie和WGLMakie,可用于调整渲染顺序(如可调谐透绘)。

方向感

默认值为 :y

控制条的方向,可以是 :y (垂直)或 :x (水平)。

道奇

默认值为 自动的

没有可用的文档。

dodge_gap

默认值为 0.03

没有可用的文档。

菲尔托

默认值为 自动的

控制柱线的基线。 默认值为零 自动的 除非条形图在日志缩放中 轴心,轴心. 对于日志规模,自动默认值为最小值的一半,因为零是日志规模的无效值。

flip_labels_at

默认值为 资讯

没有可用的文档。

外汇管理局

默认值为 真的

调整是否使用fxaa(抗锯齿,仅限GLMakie)渲染绘图。

差距

默认值为 0.2

条形的最终宽度计算如下 w*(1-间隙) 哪里 w 是每个酒吧的宽度与确定 阔度 属性。

海克利普

默认值为 自动的

Colorrange上方任何值的颜色。

可检查的

默认值为 @继承inspectable

设置此图是否应由 数据探测仪. 默认值取决于父场景的主题。

检查员-检查员

默认值为 自动的

设置回调函数 (检查员,情节)->。.. 用于清理DataInspector中的自定义指标。

检查员-检查员

默认值为 自动的

设置回调函数 (检查员,情节,索引)->。.. 它取代了默认值 显示_数据 方法。

检查器_label

默认值为 自动的

设置回调函数 (绘图、索引、位置)->字符串 它替换了DataInspector生成的默认标签。

标签-标记

默认值为 自动的

没有可用的文档。

标签颜色

默认值为 @继承textcolor

没有可用的文档。

n.标签,标签

默认值为 @继承字体

栏标签的字体。

标签-格式

默认值为 bar_label_格式

没有可用的文档。

标签_offset

默认值为 5

标签与栏的距离以屏幕单位结束。 不适用于 label_position=:中心.

标签位置

默认值为 :结束

每个条形的标签相对于条形的位置。 可能的值是 :结束:中心.

标签/标签

默认值为

没有可用的文档。

标签尺寸

默认值为 @继承fontsize

栏标签的字体大小。

低频,低频

默认值为 自动的

Colorrange以下任何值的颜色。

模型

默认值为 自动的

为绘图设置模型矩阵。 这将复盖使用 翻译!, 旋转!规模!.

n_dodge的

默认值为 自动的

没有可用的文档。

纳米色

默认值为 :透明

NaN值的颜色。

偏移量

默认值为 0.0

没有可用的文档。

透支

默认值为 错误

控制绘图是否将绘制在其他绘图上。 这具体意味着忽略GL后端中的深度检查

空间

默认值为 :数据

设置包含情节的盒子的变换空间。 见 麦琪空间() 供可能的输入。

ssao

默认值为 错误

调整是否使用ssao(屏幕空间环境光遮蔽)渲染绘图。 请注意,这仅在3D绘图中有意义,并且仅适用于 fxaa=真.

堆叠

默认值为 自动的

没有可用的文档。

[医]斯特罗克色

默认值为 @继承patchstrokecolor

没有可用的文档。

斯特罗克威德斯

默认值为 @继承patchstrokewidth

没有可用的文档。

转型

默认值为 :自动

没有可用的文档。

透明度

默认值为 错误

调整情节处理透明度的方式。 在GLMakie 透明度=真 导致使用顺序独立的透明度。

可见

默认值为 真的

控制是否渲染绘图。

阔度

默认值为 自动的

条的无间隙宽度。 如果 自动的,宽度 w 被计算为 最小(差异(排序(唯一(位置)))). 条形的实际宽度计算如下 w*(1-间隙).