You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Julia中移除各密度图独立标题,仅保留整体图表标题的方法

移除子密度图独立标题,保留全局图表标题

当前图表中每个子密度图自带独立标题(Work、Home等),只需给每个density调用添加title=""参数,即可移除子图的独立标题,同时保留全局的图表标题。

修改后的代码如下:

plot(
    size=(1200, 800),  # 调整图表尺寸(宽, 高)
    dpi=300,          # 调整分辨率(每英寸点数)
    density(distances_work, label="Work", title="", legend=:topright, alpha=0.7, linecolor=:blue),
    density(distances_home, label="Home", title="", alpha=0.7, linecolor=:green),
    density(distances_shopping, label="Shopping", title="", alpha=0.7, linecolor=:red),
    density(distances_other, label="Other", title="", alpha=0.7, linecolor=:orange),
    title="Distance Distribution by Activity",  # 全局图表标题
    xlabel="Distance (meter)",
    ylabel="Density",
    linewidth=2,
    xlims=(0, maximum([distances_work; distances_home; distances_shopping; distances_other])),
    legendtitlefontsize=8,  # 调整图例标题字号
    grid=true,
    gridcolor=:lightgray,
    legend=:topright,
    framestyle=:box,
)

修改说明

  • 给每个density()函数添加title="",强制清空子图的独立标题
  • 保留全局的title参数,确保整个图表只有一个统一标题

内容的提问来源于stack exchange,提问作者Chao

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 04:02:40