Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def add_y_axis(self, ticks=None, tick_formatter=None, name=None):
"""
See :meth:`.Chart.add_x_axis`.
"""
self._axes[Y] = Axis(ticks, tick_formatter, name)
def add_x_axis(self, ticks=None, tick_formatter=None, name=None):
"""
Create and add an X :class:`.Axis`.
If you want to set a custom axis class use :meth:`.Chart.set_x_axis`
instead.
"""
self._axes[X] = Axis(ticks, tick_formatter, name)
scale = self._scales[dimension]
axis = self._axes[dimension]
if not scale:
scale = Scale.infer(self._layers, dimension, self._types[dimension])
else:
for series, shape in self._layers:
if not scale.contains(series.min(dimension)) or not scale.contains(series.max(dimension)):
d = DIMENSION_NAMES[dimension]
warn('Data contains values outside %s scale domain. All data points may not be visible on the chart.' % d)
# Only display once per axis
break
if not axis:
axis = Axis()
return (scale, axis)
See :class:`.Grid` for additional documentation.
"""
layers = [(s, self._shape) for s in self._series]
if not self._scales[X]:
self._scales[X] = Scale.infer(layers, X, self._types[X])
if not self._scales[Y]:
self._scales[Y]= Scale.infer(layers, Y, self._types[Y])
if not self._axes[X]:
self._axes[X] = Axis()
if not self._axes[Y]:
self._axes[Y] = Axis()
grid = Grid()
for i, series in enumerate(self._series):
chart = Chart(title=series.name)
chart.set_x_scale(self._scales[X])
chart.set_y_scale(self._scales[Y])
chart.set_x_axis(self._axes[X])
chart.set_y_axis(self._axes[Y])
chart.add_series(series, self._shape)
grid.add_one(chart)
return grid.to_svg(path, width, height)
def add_y_axis(self, ticks=None, tick_formatter=None, name=None):
"""
See :meth:`.Lattice.add_x_axis`.
"""
self._axes[Y] = Axis(ticks=ticks, tick_formatter=tick_formatter, name=name)
def add_x_axis(self, ticks=None, tick_formatter=None, name=None):
"""
Create and add an X :class:`.Axis`.
If you want to set a custom axis class use :meth:`.Lattice.set_x_axis`
instead.
"""
self._axes[X] = Axis(ticks=ticks, tick_formatter=tick_formatter, name=name)