diff --git a/packages/python/plotly/plotly/io/_templates.py b/packages/python/plotly/plotly/io/_templates.py index 6a71f8764ba..6749a796bf6 100644 --- a/packages/python/plotly/plotly/io/_templates.py +++ b/packages/python/plotly/plotly/io/_templates.py @@ -42,6 +42,8 @@ def __init__(self): "plotly_dark", "presentation", "xgridoff", + "ygridoff", + "gridon", "none", ] diff --git a/packages/python/plotly/plotly/package_data/templates/gridon.json b/packages/python/plotly/plotly/package_data/templates/gridon.json new file mode 100644 index 00000000000..1890e0b30a2 --- /dev/null +++ b/packages/python/plotly/plotly/package_data/templates/gridon.json @@ -0,0 +1 @@ +{"layout": {"xaxis": {"showgrid": true}, "yaxis": {"showgrid": true}}} \ No newline at end of file diff --git a/packages/python/plotly/plotly/package_data/templates/ygridoff.json b/packages/python/plotly/plotly/package_data/templates/ygridoff.json new file mode 100644 index 00000000000..717a2c3f286 --- /dev/null +++ b/packages/python/plotly/plotly/package_data/templates/ygridoff.json @@ -0,0 +1 @@ +{"layout": {"yaxis": {"showgrid": false}}} \ No newline at end of file diff --git a/packages/python/plotly/templategen/definitions.py b/packages/python/plotly/templategen/definitions.py index ec082acacd1..e2cd9e1e333 100644 --- a/packages/python/plotly/templategen/definitions.py +++ b/packages/python/plotly/templategen/definitions.py @@ -522,7 +522,7 @@ def presentation(): def xgridoff(): """ - Tempalate to disable x-grid by default + Template to disable x-grid by default """ # Create blank template template = Template() @@ -532,3 +532,32 @@ def xgridoff(): builders["xgridoff"] = xgridoff + + +def ygridoff(): + """ + Template to disable y-grid by default + """ + # Create blank template + template = Template() + template.layout.yaxis.showgrid = False + + return template + + +builders["ygridoff"] = ygridoff + + +def gridon(): + """ + Template to enable x and y-grid by default + """ + # Create blank template + template = Template() + template.layout.xaxis.showgrid = True + template.layout.yaxis.showgrid = True + + return template + + +builders["gridon"] = gridon