【问题标题】:Rotate x-axis label in vega heatmap?在vega热图中旋转x轴标签?
【发布时间】:2020-12-04 02:34:07
【问题描述】:

我已经建立了相关矩阵的热图

  1. 如何旋转 x 轴标签
  2. 是否可以使图例垂直像

我试过了

"axes": [
      {
        "orient": "bottom", 
        "scale": "x", 
        "labelAngle": -45,
        "tickOffset": 0,
        "labelAlign": "right",
        "domain": false,
        "title": "Features"
      },
      {
        "orient": "left", 
        "scale": "y", 
        "domain": false,
        "title": "Features"
      }
  ],
  "legends": [
    {
      "orient": "right", 
      "direction" : "vertical",
      "fill": "color",
      "type": "gradient",
      "title": "Correlation",
      "titleFontSize": 12,
      "titlePadding": 4,
      "gradientLength": {"signal": "height - 16"}
    }
  ],

但没有发生

我正在使用 vega "https://vega.github.io/schema/vega/v3.json" 架构

【问题讨论】:

    标签: vega-lite vega


    【解决方案1】:

    旋转 x 轴名称,这行得通

          {
            "orient": "bottom", 
            "scale": "x", 
            "labelOverlap":false,
            "domain": false,
            "title": "Features",
            "encode": {
              "labels": {
                "update": {
                  "angle": {"value": -50},
                  "fontSize": {"value": 10},
                  "align": {"value": "right"}
                }
              }
            }  
          },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-09-02
      • 1970-01-01
      • 2012-05-04
      • 2017-07-10
      • 2020-11-30
      • 1970-01-01
      相关资源
      最近更新 更多