@@ -38,6 +38,10 @@ class JaninPlot(WidgetBase):
3838 Show allowed and marginally allowed regions
3939 Default: ``True``
4040
41+ Custom title
42+ Custom title for the plot
43+ Default: ''
44+
4145 **Output**
4246
4347 Here is an example output plot of this widget:
@@ -50,6 +54,11 @@ class JaninPlot(WidgetBase):
5054 name = "Janin Plot"
5155 description = "Dihedral angles analysis using Janin plot"
5256
57+ _doclink = (
58+ "https://mdadash.readthedocs.io/en/latest/autosummary/"
59+ "mdadash.backend.analyses.janin.html"
60+ )
61+
5362 _inputs : ClassVar = [
5463 {
5564 "attribute" : "selection" ,
@@ -64,24 +73,32 @@ class JaninPlot(WidgetBase):
6473 "description" : "Show allowed and marginally allowed regions" ,
6574 "type" : "bool" ,
6675 },
76+ {
77+ "attribute" : "custom_title" ,
78+ "name" : "Custom title" ,
79+ "description" : "Custom title for the plot" ,
80+ "type" : "str" ,
81+ },
6782 ]
6883
6984 def __init__ (self ):
7085 super ().__init__ ()
7186 self .selection = "protein"
7287 self .ref = True
7388 self .janin = None
89+ self .title = "protein"
90+ self .custom_title = None
7491 self ._setup_plot ()
7592
7693 def _setup_plot (self ):
7794 """Setup matplotlib plot"""
7895 self .fig , self .ax = plt .subplots ()
7996 (self .plot ,) = self .ax .plot ([], [])
80- self .ax .grid (True )
8197
8298 def _update_selection (self ):
8399 """Update atom groups when selection phrase changes"""
84100 self .janin = Janin (self .u .select_atoms (self .selection ))
101+ self .title = f"{ self .selection } "
85102
86103 def on_post_connect (self ):
87104 """on_post_connect handler"""
@@ -108,5 +125,8 @@ def run_every_frame(self):
108125 self .janin .plot (ax = self .ax , color = "black" , marker = "." , ref = self .ref )
109126 self .ax .set_xlabel (r"$\chi_1$ (degrees)" )
110127 self .ax .set_ylabel (r"$\chi_2$ (degrees)" )
128+ self .ax .set_title (
129+ self .custom_title .replace ("\\ n" , "\n " ) if self .custom_title else self .title
130+ )
111131 self .fig .canvas .draw ()
112132 display (self .fig )
0 commit comments