Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9da7cec

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

File tree

Expand file treeCollapse file tree

4 files changed

+34
-1
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+34
-1
lines changed

‎packages/python/plotly/plotly/io/_templates.py

Copy file name to clipboardExpand all lines: packages/python/plotly/plotly/io/_templates.py
+2Lines changed: 2 additions & 0 deletions
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

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

‎packages/python/plotly/templategen/definitions.py

Copy file name to clipboardExpand all lines: packages/python/plotly/templategen/definitions.py
+30-1Lines changed: 30 additions & 1 deletion
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.