def __init__( self, arg=None, bgcolor=None, bordercolor=None, borderwidth=None, font=None, orientation=None, tracegroupgap=None, traceorder=None, x=None, xanchor=None, y=None, yanchor=None, **kwargs ): """ Construct a new Legend object Parameters ---------- arg dict of properties compatible with this constructor or an instance of plotly.graph_objs.layout.Legend bgcolor Sets the legend background color. bordercolor Sets the color of the border enclosing the legend. borderwidth Sets the width (in px) of the border enclosing the legend. font Sets the font used to text the legend items. orientation Sets the orientation of the legend. tracegroupgap Sets the amount of vertical space (in px) between legend groups. traceorder Determines the order at which the legend items are displayed. If *normal*, the items are displayed top-to- bottom in the same order as the input data. If *reversed*, the items are displayed in the opposite order as *normal*. If *grouped*, the items are displayed in groups (when a trace `legendgroup` is provided). if *grouped+reversed*, the items are displayed in the opposite order as *grouped*. x Sets the x position (in normalized coordinates) of the legend. xanchor Sets the legend's horizontal position anchor. This anchor binds the `x` position to the *left*, *center* or *right* of the legend. y Sets the y position (in normalized coordinates) of the legend. yanchor Sets the legend's vertical position anchor This anchor binds the `y` position to the *top*, *middle* or *bottom* of the legend. Returns ------- Legend """ super(Legend, self).__init__('legend') # Validate arg # ------------ if arg is None: arg = {} elif isinstance(arg, self.__class__): arg = arg.to_plotly_json() elif isinstance(arg, dict): arg = copy.copy(arg) else: raise ValueError( """\ The first argument to the plotly.graph_objs.layout.Legend constructor must be a dict or an instance of plotly.graph_objs.layout.Legend""" ) # Import validators # ----------------- from plotly.validators.layout import (legend as v_legend) # Initialize validators # --------------------- self._validators['bgcolor'] = v_legend.BgcolorValidator() self._validators['bordercolor'] = v_legend.BordercolorValidator() self._validators['borderwidth'] = v_legend.BorderwidthValidator() self._validators['font'] = v_legend.FontValidator() self._validators['orientation'] = v_legend.OrientationValidator() self._validators['tracegroupgap'] = v_legend.TracegroupgapValidator() self._validators['traceorder'] = v_legend.TraceorderValidator() self._validators['x'] = v_legend.XValidator() self._validators['xanchor'] = v_legend.XanchorValidator() self._validators['y'] = v_legend.YValidator() self._validators['yanchor'] = v_legend.YanchorValidator() # Populate data dict with properties # ---------------------------------- _v = arg.pop('bgcolor', None) self.bgcolor = bgcolor if bgcolor is not None else _v _v = arg.pop('bordercolor', None) self.bordercolor = bordercolor if bordercolor is not None else _v _v = arg.pop('borderwidth', None) self.borderwidth = borderwidth if borderwidth is not None else _v _v = arg.pop('font', None) self.font = font if font is not None else _v _v = arg.pop('orientation', None) self.orientation = orientation if orientation is not None else _v _v = arg.pop('tracegroupgap', None) self.tracegroupgap = tracegroupgap if tracegroupgap is not None else _v _v = arg.pop('traceorder', None) self.traceorder = traceorder if traceorder is not None else _v _v = arg.pop('x', None) self.x = x if x is not None else _v _v = arg.pop('xanchor', None) self.xanchor = xanchor if xanchor is not None else _v _v = arg.pop('y', None) self.y = y if y is not None else _v _v = arg.pop('yanchor', None) self.yanchor = yanchor if yanchor is not None else _v # Process unknown kwargs # ---------------------- self._process_kwargs(**dict(arg, **kwargs))
def __init__(self, arg=None, bgcolor=None, bordercolor=None, borderwidth=None, font=None, orientation=None, tracegroupgap=None, traceorder=None, uirevision=None, valign=None, x=None, xanchor=None, y=None, yanchor=None, **kwargs): """ Construct a new Legend object Parameters ---------- arg dict of properties compatible with this constructor or an instance of plotly.graph_objs.layout.Legend bgcolor Sets the legend background color. bordercolor Sets the color of the border enclosing the legend. borderwidth Sets the width (in px) of the border enclosing the legend. font Sets the font used to text the legend items. orientation Sets the orientation of the legend. tracegroupgap Sets the amount of vertical space (in px) between legend groups. traceorder Determines the order at which the legend items are displayed. If "normal", the items are displayed top-to- bottom in the same order as the input data. If "reversed", the items are displayed in the opposite order as "normal". If "grouped", the items are displayed in groups (when a trace `legendgroup` is provided). if "grouped+reversed", the items are displayed in the opposite order as "grouped". uirevision Controls persistence of legend-driven changes in trace and pie label visibility. Defaults to `layout.uirevision`. valign Sets the vertical alignment of the symbols with respect to their associated text. x Sets the x position (in normalized coordinates) of the legend. xanchor Sets the legend's horizontal position anchor. This anchor binds the `x` position to the "left", "center" or "right" of the legend. y Sets the y position (in normalized coordinates) of the legend. yanchor Sets the legend's vertical position anchor This anchor binds the `y` position to the "top", "middle" or "bottom" of the legend. Returns ------- Legend """ super(Legend, self).__init__('legend') # Validate arg # ------------ if arg is None: arg = {} elif isinstance(arg, self.__class__): arg = arg.to_plotly_json() elif isinstance(arg, dict): arg = copy.copy(arg) else: raise ValueError("""\ The first argument to the plotly.graph_objs.layout.Legend constructor must be a dict or an instance of plotly.graph_objs.layout.Legend""") # Handle skip_invalid # ------------------- self._skip_invalid = kwargs.pop('skip_invalid', False) # Import validators # ----------------- from plotly.validators.layout import (legend as v_legend) # Initialize validators # --------------------- self._validators['bgcolor'] = v_legend.BgcolorValidator() self._validators['bordercolor'] = v_legend.BordercolorValidator() self._validators['borderwidth'] = v_legend.BorderwidthValidator() self._validators['font'] = v_legend.FontValidator() self._validators['orientation'] = v_legend.OrientationValidator() self._validators['tracegroupgap'] = v_legend.TracegroupgapValidator() self._validators['traceorder'] = v_legend.TraceorderValidator() self._validators['uirevision'] = v_legend.UirevisionValidator() self._validators['valign'] = v_legend.ValignValidator() self._validators['x'] = v_legend.XValidator() self._validators['xanchor'] = v_legend.XanchorValidator() self._validators['y'] = v_legend.YValidator() self._validators['yanchor'] = v_legend.YanchorValidator() # Populate data dict with properties # ---------------------------------- _v = arg.pop('bgcolor', None) self['bgcolor'] = bgcolor if bgcolor is not None else _v _v = arg.pop('bordercolor', None) self['bordercolor'] = bordercolor if bordercolor is not None else _v _v = arg.pop('borderwidth', None) self['borderwidth'] = borderwidth if borderwidth is not None else _v _v = arg.pop('font', None) self['font'] = font if font is not None else _v _v = arg.pop('orientation', None) self['orientation'] = orientation if orientation is not None else _v _v = arg.pop('tracegroupgap', None) self[ 'tracegroupgap'] = tracegroupgap if tracegroupgap is not None else _v _v = arg.pop('traceorder', None) self['traceorder'] = traceorder if traceorder is not None else _v _v = arg.pop('uirevision', None) self['uirevision'] = uirevision if uirevision is not None else _v _v = arg.pop('valign', None) self['valign'] = valign if valign is not None else _v _v = arg.pop('x', None) self['x'] = x if x is not None else _v _v = arg.pop('xanchor', None) self['xanchor'] = xanchor if xanchor is not None else _v _v = arg.pop('y', None) self['y'] = y if y is not None else _v _v = arg.pop('yanchor', None) self['yanchor'] = yanchor if yanchor is not None else _v # Process unknown kwargs # ---------------------- self._process_kwargs(**dict(arg, **kwargs)) # Reset skip_invalid # ------------------ self._skip_invalid = False