Skip to content

Commit 9da7cec

Browse files
joelostblomemmanuelle
authored andcommitted
Add additional templates to control grid lines (#1874)
* Add ygrid template * Add gridon template * Fix typo * Generate json template files
1 parent 2b42d85 commit 9da7cec

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

Diff for: packages/python/plotly/plotly/io/_templates.py

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def __init__(self):
4242
"plotly_dark",
4343
"presentation",
4444
"xgridoff",
45+
"ygridoff",
46+
"gridon",
4547
"none",
4648
]
4749

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"layout": {"xaxis": {"showgrid": true}, "yaxis": {"showgrid": true}}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"layout": {"yaxis": {"showgrid": false}}}

Diff for: packages/python/plotly/templategen/definitions.py

+30-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def presentation():
522522

523523
def xgridoff():
524524
"""
525-
Tempalate to disable x-grid by default
525+
Template to disable x-grid by default
526526
"""
527527
# Create blank template
528528
template = Template()
@@ -532,3 +532,32 @@ def xgridoff():
532532

533533

534534
builders["xgridoff"] = xgridoff
535+
536+
537+
def ygridoff():
538+
"""
539+
Template to disable y-grid by default
540+
"""
541+
# Create blank template
542+
template = Template()
543+
template.layout.yaxis.showgrid = False
544+
545+
return template
546+
547+
548+
builders["ygridoff"] = ygridoff
549+
550+
551+
def gridon():
552+
"""
553+
Template to enable x and y-grid by default
554+
"""
555+
# Create blank template
556+
template = Template()
557+
template.layout.xaxis.showgrid = True
558+
template.layout.yaxis.showgrid = True
559+
560+
return template
561+
562+
563+
builders["gridon"] = gridon

0 commit comments

Comments
 (0)