# Wrapped Facet in vega

**URL:** https://discuss.elastic.co/t/wrapped-facet-in-vega/265601
**Category:** Kibana
**Tags:** vega
**Created:** [February 26, 2021, 11:11am UTC](https://discuss.elastic.co/t/wrapped-facet-in-vega/265601 "2021-02-26T11:11:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Pranusha119](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@Pranusha119](https://discuss.elastic.co/u/Pranusha119)
#### Post date: [February 26, 2021, 11:11am UTC](https://discuss.elastic.co/t/wrapped-facet-in-vega/265601/1 "2021-02-26T11:11:05Z")

</div>

Hello,

I have used facet as well as layer in below code, I tried to limit no. of columns to 2 but it wasn't working.

```auto
{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "name": "trellis_barley",
  "description": "The Trellis display by Becker et al. helped establish small multiples as a “powerful mechanism for understanding interactions in studies of how a response depends on explanatory variables”. Here we reproduce a trellis of Barley yields from the 1930s, complete with main-effects ordering to facilitate comparison.",
  "data": {"url": "data/barley.json"},
   "facet": {
    
     "field": "site",
      "type": "ordinal",
     "columns":2   
    },
    "spec":{
  "layer":[{
  "mark": "point",
  "height": {"step": 12},
  "encoding": {
    "y": {
      "aggregate": "median",
      "field": "yield",
      "type": "quantitative",
      "scale": {"zero": false}
    },
    "x": {"field": "variety", "type": "ordinal", "sort": "-x"},
    "color": {"field": "year", "type": "nominal"}
  }
  },
  {
  "mark": "line",
  "height": {"step": 12},
  "encoding": {
    "y": {
      "aggregate": "sum",
      "field": "yield",
      "type": "quantitative",
      "scale": {"zero": false}
    },
    "x": {"field": "variety", "type": "ordinal", "sort": "-x"},
    "color": {"value": "#000000"}
  }
  }] ,"resolve": {"axis": { "y": "independent"}}},
  "resolve": {
        "scale": {"y": "independent"},
        "axis": {"y": "independent"}
    }
}

```

output :

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/e/5ed054452e803f68099a5800a1090685d4e29f55.png)

I require the output in this manner, where data is wrapped in 2 columns. Any suggestions on how can I get it ?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/0/f0b4e33ace0305ac8f0cf87f951c451df8e0f4fa.png)

---

<div class="post-metadata">

### Author: ![gmmorris](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gmmorris/32/72624_2.png) [@gmmorris](https://discuss.elastic.co/u/gmmorris)
#### Post date: [February 26, 2021, 5:26pm UTC](https://discuss.elastic.co/t/wrapped-facet-in-vega/265601/2 "2021-02-26T17:26:14Z")

</div>

Hi @Pranusha119 ,

These kinds of problems aren't generally at the level of Kibana, but actually at the Vega library itself.

I recommend using the Vega editor to figure out the issue, as you can see [here](https://vega.github.io/editor/#/url/vega-lite/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykBaADZ04JAKyUAVhDYA7EABoQspAjhoQmAE5xBwiAH0mSLYLgBPRSAAmcaFpo5M7eegAq8AARudemhE9rfxxBJHNPJnCAITgoAGs4LU84TE8kQUpPeEEcOGtkiEwkJn0YTwhkPU8EBkFnELs0gKRPQBwCHDYAd0SAM1rq2JgkWX8ETx62JIZZWy1C4aDZMk8aWUxEpChnOQDV8swGIMa2HqyutM8dCA7ZCDhAuFyZgLlkgA8Q4aRMSfDiExoxTMEEAuASZAASiXu3Uujy0bGsDCg9xa2l0+k8J08URMZnC5houmsAR68LG9HuAEYAJwAZgADBAFJ4oGwEA11p5OnQyshVvw4D0erFMC8tLNVssfuNNjRhEVOaz2QCZLJKFZrN8UKhQAxTBpNUUCMZTBYpKqQABfJQ9TYpNCgHqEwTWDQQERWTDmXIaSaLdJWpSswQMBC3NAAJiU11iDpAoXMiTQAG1QMgtHENB1VpgrPAaGQsHHCo80JSI9aQHBZKzFmQ45YdSAkGQyDoKOsNGogsMrE6iRoCQOlF6fegAI4MYbOBU0UhWaDpdRNgBeiTYaFtgjulsrbzj-ZdGn+DhSlhH3uXID9qwD0cmufQ-H3leDkwPztd6ETJk9l40shsreghWruChpiYmboMIsjqEo+aFo+oAljgZYVko1a1pKDZxi2bZ8J26AQKGfafoOZEXmOICTtOdDfHOcEgIuZhxmu8KbukO57h+A7oCehJen+VE3ioIH3loj4gM+gYgG+Whxv8IZXgAxPSanqaBloALpKFcbCCPOTZIG8-g4egqy2E8thrJpul2PphnIVAS5mSAFmPNW1m5pWxmmU2jZuTMHlBTZu6WkAA).

Once I pasted in your code, the editor showed me the problem - the `colums` field belongs on the root object, not under `facet`.  
If you look at the link above, you'll see it works. 🙂

Kibana is just providing a wrapper around Vega, so in general you'll find it helpful to start at that level and work your way down. 😃

---

<div class="post-metadata">

### Author: ![Pranusha119](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@Pranusha119](https://discuss.elastic.co/u/Pranusha119)
#### Post date: [March 1, 2021, 8:19am UTC](https://discuss.elastic.co/t/wrapped-facet-in-vega/265601/3 "2021-03-01T08:19:22Z")

</div>

Thanks @gmmorris

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 29, 2021, 8:19am UTC](https://discuss.elastic.co/t/wrapped-facet-in-vega/265601/4 "2021-03-29T08:19:37Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
