88# Class that generates composite and reference lines svg elements
99class Plot :
1010 def __init__ (self , title = None , xmin = None , xmax = None , ymin = None , ymax = None , xlabel = None , ylabel = None ,
11- opacity = None , smoothing = None , bp_shift = None , combined = False , color_trace = False , hide_legend = True ):
11+ opacity = None , smoothing = None , bp_shift = None , combined = False , color_trace = False , hide_legend = False ):
1212 # Set variables to defaults if argument passed into constructor was None
1313 self .title = title if title is not None else "Composite plot"
1414 self .xmin = xmin if xmin is not None else - 500
@@ -147,7 +147,7 @@ def plot_composite(self, xmin, xmax, sense, anti, scale=1, color=None, secondary
147147 self .plot .appendChild (self .gradients_group )
148148 self .plot .appendChild (self .composite_group )
149149
150- # Creates a composite svg element from a composite_group object, like plotting a row form the settings table
150+ # Creates a composite svg element from a composite object, like plotting a row form the settings table
151151 def plot_composite (self , composite ):
152152 # Set parameters to global values if not specified
153153 opacity = composite .opacity if composite .opacity is not None else self .opacity
@@ -177,7 +177,7 @@ def plot_composite(self, composite):
177177 composite_fill_top = document .createElement ("polygon" )
178178 composite_fill_top .setAttribute ("points" , " " .join (points := [f"{ self .xscale .get (d )} ,{ self .yscale .get (scaled_occupancy [j ])} " for j , d in enumerate (truncated_xdomain )]) + f" { self .xscale .get (truncated_xdomain [- 1 ])} ,{ self .yscale .get (0 )} { self .xscale .get (truncated_xdomain [0 ])} ,{ self .yscale .get (0 )} " )
179179 composite_fill_top .setAttribute ("fill" , "url(#composite-gradient-top" + str (i ) + ")" )
180- self .composite .appendChild (composite_fill_top )
180+ self .composite_group .appendChild (composite_fill_top )
181181 #Create outline
182182 wide_trace = document .createElement ("path" )
183183 wide_trace .setAttribute ("stroke-width" , "1" )
@@ -334,18 +334,18 @@ def create_legend(self):
334334 legend = document .createElement ('g' )
335335 legend .setAttribute ("transform" , "translate(" + str (self .width - self .margins .get ("right" ) + 25 ) + " " + str (self .margins .get ("top" )) + ")" )
336336 i = 0
337- for composite_group in self .composites :
337+ for composite in self .composites :
338338 # Creates legend entries for each composite
339339 legend_element = document .createElement ("g" )
340340 legend_element .setAttribute ("transform" , "translate(0," + str (24 * i ) + ")" )
341341 legend_color_sense = document .createElement ("polygon" )
342342 legend_color_sense .setAttribute ("points" , "0,0 15,0 15,15 0,15" )
343- legend_color_sense .setAttribute ("fill" , composite_group .color )
343+ legend_color_sense .setAttribute ("fill" , composite .color )
344344 legend_element .appendChild (legend_color_sense )
345345 legend_color_anti = document .createElement ("polygon" )
346346 legend_color_anti .setAttribute ("points" , "0,0 15,0 15,15 0,15" )
347347 legend_element .appendChild (legend_color_anti )
348- legend_color_anti .setAttribute ("fill" , composite_group .secondary_color )
348+ legend_color_anti .setAttribute ("fill" , composite .secondary_color )
349349 legend_border = document .createElement ("rect" )
350350 legend_border .setAttribute ("width" , "15" )
351351 legend_border .setAttribute ("height" , "15" )
@@ -356,7 +356,7 @@ def create_legend(self):
356356 id .setAttribute ("x" , "20" )
357357 id .setAttribute ("y" , "10" )
358358 id .setAttribute ("font-size" , "10" )
359- id .appendChild (document .createTextNode (str (composite_group .name )))
359+ id .appendChild (document .createTextNode (str (composite .name )))
360360 legend_element .appendChild (id )
361361 legend .appendChild (legend_element )
362362 i += 1
0 commit comments