Forum Discussion

BeWu's avatar
BeWu
Frequent Visitor
3 years ago

boxplot with jittering

Hi, 

 

I have a boxplot created using visual "Box and Whisker by MAQ Software". 

Is it possible to add jittering to the boxplot? When I create a measure 

Jitter = 0 - (RAND() - 0.2) it is not possible to add it into Axis category. Any ideas how to solve this problem ? (greenish points represent number of people entering rooms montly, each point = room). Thanks for help and suggestions. 

 

 

1 Reply

  • ppm1's avatar
    ppm1
    Solution Sage

    Here's an example of one way to do it, with the Deneb visual.

     

    Getting Started | Deneb

    {
      "data": {"name": "dataset"},
      "facet": {
        "column": {"field": "Subcategory"}
      },
      "spec": {
        "transform": [
          {
            "calculate": "random()-0.5",
            "as": "jitter"
          }
        ],
        "layer": [
          {
            "mark": "point",
            "encoding": {
              "x": {
                "field": "jitter",
                "type": "quantitative",
                "scale": {
                  "domain": [-10, 10]
                },
                "axis": null
              },
              "y": {
                "field": "Total Qty",
                "type": "quantitative"
              }
            }
          },
          {
            "mark": {
              "type": "boxplot",
              "extent": "min-max"
            },
            "encoding": {
              "y": {
                "field": "Total Qty",
                "type": "quantitative"
              }
            }
          }
        ]
      }
    }

     

    Pat