<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setup(self, **kwargs):
 """Set up the transient state prior rendering"""

        # Keep labels in case of map
        if getattr(self, 'x_labels', None) is not None:
            self.x_labels = list(self.x_labels)
        if getattr(self, 'y_labels', None) is not None:
            self.y_labels = list(self.y_labels)
        self.state = State(self, **kwargs)
        if isinstance(self.style, type):
            self.style = self.style()
        self.series = self.prepare_values([
            rs for rs in self.raw_series if not rs[1].get('secondary')
        ]) or []
        self.secondary_series = self.prepare_values([
            rs for rs in self.raw_series if rs[1].get('secondary')
        ], len(self.series)) or []
        self.horizontal = getattr(self, 'horizontal', False)
        self.svg = Svg(self)
        self._x_labels = None
        self._y_labels = None
        self._x_2nd_labels = None
        self._y_2nd_labels = None
        self.nodes = {}
        self.margin_box = Margin(
            self.margin_top or self.margin, self.margin_right or self.margin,
            self.margin_bottom or self.margin, self.margin_left or self.margin
        )
        self._box = Box()
        self.view = None
        if self.logarithmic and self.zero == 0:
            # Explicit min to avoid interpolation dependency
            positive_values = list(
                filter(
                    lambda x: x > 0, [
                        val[1] or 1 if self._dual else val
                        for serie in self.series for val in serie.safe_values
                    ]
                )
            )

            self.zero = min(positive_values or (1, )) or 1
        if self._len < 3:
            self.interpolate = None
        self._draw()
        self.svg.pre_render()