From 7dc595ff08300ca415c8d45ee69c5377b718f2c9 Mon Sep 17 00:00:00 2001 From: joelostblom Date: Tue, 5 Nov 2019 15:29:15 +0100 Subject: [PATCH 1/4] Fix typo --- packages/python/plotly/templategen/definitions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/plotly/templategen/definitions.py b/packages/python/plotly/templategen/definitions.py index ec082acacd1..fd0d4f245ad 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() From ac8f67658849c53ffd4876775c77e552749ce28f Mon Sep 17 00:00:00 2001 From: joelostblom Date: Tue, 5 Nov 2019 15:28:27 +0100 Subject: [PATCH 2/4] Add ygrid template --- packages/python/plotly/plotly/io/_templates.py | 1 + packages/python/plotly/templategen/definitions.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/packages/python/plotly/plotly/io/_templates.py b/packages/python/plotly/plotly/io/_templates.py index 6a71f8764ba..5afc2f73788 100644 --- a/packages/python/plotly/plotly/io/_templates.py +++ b/packages/python/plotly/plotly/io/_templates.py @@ -42,6 +42,7 @@ def __init__(self): "plotly_dark", "presentation", "xgridoff", + "ygridoff", "none", ] diff --git a/packages/python/plotly/templategen/definitions.py b/packages/python/plotly/templategen/definitions.py index fd0d4f245ad..086aedb3b7f 100644 --- a/packages/python/plotly/templategen/definitions.py +++ b/packages/python/plotly/templategen/definitions.py @@ -532,3 +532,18 @@ 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 + From 7c8fe4f41607893810cca4619f34a93d328da824 Mon Sep 17 00:00:00 2001 From: joelostblom Date: Tue, 5 Nov 2019 15:29:03 +0100 Subject: [PATCH 3/4] Add gridon template --- packages/python/plotly/plotly/io/_templates.py | 1 + packages/python/plotly/templategen/definitions.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/packages/python/plotly/plotly/io/_templates.py b/packages/python/plotly/plotly/io/_templates.py index 5afc2f73788..6749a796bf6 100644 --- a/packages/python/plotly/plotly/io/_templates.py +++ b/packages/python/plotly/plotly/io/_templates.py @@ -43,6 +43,7 @@ def __init__(self): "presentation", "xgridoff", "ygridoff", + "gridon", "none", ] diff --git a/packages/python/plotly/templategen/definitions.py b/packages/python/plotly/templategen/definitions.py index 086aedb3b7f..e2cd9e1e333 100644 --- a/packages/python/plotly/templategen/definitions.py +++ b/packages/python/plotly/templategen/definitions.py @@ -547,3 +547,17 @@ def ygridoff(): 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 From ac3b77df133ea1b803e21d03fe9fb8dea41276e9 Mon Sep 17 00:00:00 2001 From: joelostblom Date: Tue, 5 Nov 2019 15:29:43 +0100 Subject: [PATCH 4/4] Generate json template files --- packages/python/plotly/plotly/package_data/templates/gridon.json | 1 + .../python/plotly/plotly/package_data/templates/ygridoff.json | 1 + 2 files changed, 2 insertions(+) create mode 100644 packages/python/plotly/plotly/package_data/templates/gridon.json create mode 100644 packages/python/plotly/plotly/package_data/templates/ygridoff.json 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