Cannot combine layout and transform

I’m new to Plotly and Dash, so please bear with me. I cannot, for the life of me, figure out how to combine both a layout and a transform.

This code works:

data: [{
    "x": x,
    "y": y,
    "mode": 'markers',
    "transforms": [{
        "type": 'aggregate',
        "groups": x,
        "aggregations": [{
            "target": 'y',
            "func": 'count',
            "enabled": True,
        }]
    }]
}]

plot_div = py.plot(
    {'data': data},
    validate=False,
    output_type='div')

This code works:

plot_div = py.plot({
    "data": [{
        "x": x,
        "y": y,
        "mode":'markers',
    }],
    "layout": {
        "title": "hello world"
    },
}, output_type='div')

But I want to have something like the following and I can’t figure it out. For what it’s worth, x & y come from a pandas dataframe. I didn’t include that info in the code snippets above, since both of the previous code snippets work, I’m pretty sure it’s just something I’m doing wrong in the syntax below. Any help is appreciated:

plot_div = py.plot({
    "data": data,
    "layout": {"title": "hello world"},
}, output_type='div')

The folks over at #api:python or #dash should be able to help you out. Thanks for using plotly!

I figured it out. Using this example as a template I got it to work. Thanks for the response!

https://plot.ly/python/multiple-transforms/