diff options
Diffstat (limited to 'silx/gui/plot/PlotWidget.py')
-rw-r--r-- | silx/gui/plot/PlotWidget.py | 492 |
1 files changed, 196 insertions, 296 deletions
diff --git a/silx/gui/plot/PlotWidget.py b/silx/gui/plot/PlotWidget.py index e023a21..cfe39fa 100644 --- a/silx/gui/plot/PlotWidget.py +++ b/silx/gui/plot/PlotWidget.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2004-2018 European Synchrotron Radiation Facility +# Copyright (c) 2004-2019 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -31,7 +31,7 @@ from __future__ import division __authors__ = ["V.A. Sole", "T. Vincent"] __license__ = "MIT" -__date__ = "12/10/2018" +__date__ = "21/12/2018" from collections import OrderedDict, namedtuple @@ -44,7 +44,6 @@ import numpy import silx from silx.utils.weakref import WeakMethodProxy -from silx.utils import deprecation from silx.utils.property import classproperty from silx.utils.deprecation import deprecated # Import matplotlib backend here to init matplotlib our way @@ -99,7 +98,7 @@ class PlotWidget(qt.QMainWindow): # TODO: Can be removed for silx 0.10 @classproperty - @deprecation.deprecated(replacement="silx.config.DEFAULT_PLOT_BACKEND", since_version="0.8", skip_backtrace_count=2) + @deprecated(replacement="silx.config.DEFAULT_PLOT_BACKEND", since_version="0.8", skip_backtrace_count=2) def DEFAULT_BACKEND(self): """Class attribute setting the default backend for all instances.""" return silx.config.DEFAULT_PLOT_BACKEND @@ -193,21 +192,12 @@ class PlotWidget(qt.QMainWindow): It provides the visible state. """ - def __init__(self, parent=None, backend=None, - legends=False, callback=None, **kw): + def __init__(self, parent=None, backend=None): self._autoreplot = False self._dirty = False self._cursorInPlot = False self.__muteActiveItemChanged = False - if kw: - _logger.warning( - 'deprecated: __init__ extra arguments: %s', str(kw)) - if legends: - _logger.warning('deprecated: __init__ legend argument') - if callback: - _logger.warning('deprecated: __init__ callback argument') - self._panWithArrowKeys = True self._viewConstrains = None @@ -218,27 +208,8 @@ class PlotWidget(qt.QMainWindow): else: self.setWindowTitle('PlotWidget') - if backend is None: - backend = silx.config.DEFAULT_PLOT_BACKEND - - if hasattr(backend, "__call__"): - self._backend = backend(self, parent) - - elif hasattr(backend, "lower"): - lowerCaseString = backend.lower() - if lowerCaseString in ("matplotlib", "mpl"): - backendClass = BackendMatplotlibQt - elif lowerCaseString in ('gl', 'opengl'): - from .backends.BackendOpenGL import BackendOpenGL - backendClass = BackendOpenGL - elif lowerCaseString == 'none': - from .backends.BackendBase import BackendBase as backendClass - else: - raise ValueError("Backend not supported %s" % backend) - self._backend = backendClass(self, parent) - - else: - raise ValueError("Backend not supported %s" % str(backend)) + self._backend = None + self._setBackend(backend) self.setCallback() # set _callback @@ -258,6 +229,12 @@ class PlotWidget(qt.QMainWindow): self._activeLegend = {'curve': None, 'image': None, 'scatter': None} + # plot colors (updated later to sync backend) + self._foregroundColor = 0., 0., 0., 1. + self._gridColor = .7, .7, .7, 1. + self._backgroundColor = 1., 1., 1., 1. + self._dataBackgroundColor = None + # default properties self._cursorConfiguration = None @@ -275,7 +252,7 @@ class PlotWidget(qt.QMainWindow): self.setDefaultColormap() # Init default colormap - self.setDefaultPlotPoints(False) + self.setDefaultPlotPoints(silx.config.DEFAULT_PLOT_CURVE_SYMBOL_MODE) self.setDefaultPlotLines(True) self._limitsHistory = LimitsHistory(self) @@ -306,9 +283,41 @@ class PlotWidget(qt.QMainWindow): self.setGraphYLimits(0., 100., axis='right') self.setGraphYLimits(0., 100., axis='left') + # Sync backend colors with default ones + self._foregroundColorsUpdated() + self._backgroundColorsUpdated() + + def _setBackend(self, backend): + """Setup a new backend""" + assert(self._backend is None) + + if backend is None: + backend = silx.config.DEFAULT_PLOT_BACKEND + + if hasattr(backend, "__call__"): + backend = backend(self, self) + + elif hasattr(backend, "lower"): + lowerCaseString = backend.lower() + if lowerCaseString in ("matplotlib", "mpl"): + backendClass = BackendMatplotlibQt + elif lowerCaseString in ('gl', 'opengl'): + from .backends.BackendOpenGL import BackendOpenGL + backendClass = BackendOpenGL + elif lowerCaseString == 'none': + from .backends.BackendBase import BackendBase as backendClass + else: + raise ValueError("Backend not supported %s" % backend) + backend = backendClass(self, self) + + else: + raise ValueError("Backend not supported %s" % str(backend)) + + self._backend = backend + # TODO: Can be removed for silx 0.10 @staticmethod - @deprecation.deprecated(replacement="silx.config.DEFAULT_PLOT_BACKEND", since_version="0.8", skip_backtrace_count=2) + @deprecated(replacement="silx.config.DEFAULT_PLOT_BACKEND", since_version="0.8", skip_backtrace_count=2) def setDefaultBackend(backend): """Set system wide default plot backend. @@ -349,6 +358,119 @@ class PlotWidget(qt.QMainWindow): if self._autoreplot and not wasDirty and self.isVisible(): self._backend.postRedisplay() + def _foregroundColorsUpdated(self): + """Handle change of foreground/grid color""" + if self._gridColor is None: + gridColor = self._foregroundColor + else: + gridColor = self._gridColor + self._backend.setForegroundColors( + self._foregroundColor, gridColor) + self._setDirtyPlot() + + def getForegroundColor(self): + """Returns the RGBA colors used to display the foreground of this widget + + :rtype: qt.QColor + """ + return qt.QColor.fromRgbF(*self._foregroundColor) + + def setForegroundColor(self, color): + """Set the foreground color of this widget. + + :param Union[List[int],List[float],QColor] color: + The new RGB(A) color. + """ + color = colors.rgba(color) + if self._foregroundColor != color: + self._foregroundColor = color + self._foregroundColorsUpdated() + + def getGridColor(self): + """Returns the RGBA colors used to display the grid lines + + An invalid QColor is returned if there is no grid color, + in which case the foreground color is used. + + :rtype: qt.QColor + """ + if self._gridColor is None: + return qt.QColor() # An invalid color + else: + return qt.QColor.fromRgbF(*self._gridColor) + + def setGridColor(self, color): + """Set the grid lines color + + :param Union[List[int],List[float],QColor,None] color: + The new RGB(A) color. + """ + if isinstance(color, qt.QColor) and not color.isValid(): + color = None + if color is not None: + color = colors.rgba(color) + if self._gridColor != color: + self._gridColor = color + self._foregroundColorsUpdated() + + def _backgroundColorsUpdated(self): + """Handle change of background/data background color""" + if self._dataBackgroundColor is None: + dataBGColor = self._backgroundColor + else: + dataBGColor = self._dataBackgroundColor + self._backend.setBackgroundColors( + self._backgroundColor, dataBGColor) + self._setDirtyPlot() + + def getBackgroundColor(self): + """Returns the RGBA colors used to display the background of this widget. + + :rtype: qt.QColor + """ + return qt.QColor.fromRgbF(*self._backgroundColor) + + def setBackgroundColor(self, color): + """Set the background color of this widget. + + :param Union[List[int],List[float],QColor] color: + The new RGB(A) color. + """ + color = colors.rgba(color) + if self._backgroundColor != color: + self._backgroundColor = color + self._backgroundColorsUpdated() + + def getDataBackgroundColor(self): + """Returns the RGBA colors used to display the background of the plot + view displaying the data. + + An invalid QColor is returned if there is no data background color. + + :rtype: qt.QColor + """ + if self._dataBackgroundColor is None: + # An invalid color + return qt.QColor() + else: + return qt.QColor.fromRgbF(*self._dataBackgroundColor) + + def setDataBackgroundColor(self, color): + """Set the background color of this widget. + + Set to None or an invalid QColor to use the background color. + + :param Union[List[int],List[float],QColor,None] color: + The new RGB(A) color. + """ + if isinstance(color, qt.QColor) and not color.isValid(): + color = None + if color is not None: + color = colors.rgba(color) + if self._dataBackgroundColor != color: + self._dataBackgroundColor = color + self._backgroundColorsUpdated() + def showEvent(self, event): if self._autoreplot and self._dirty: self._backend.postRedisplay() @@ -528,13 +650,13 @@ class PlotWidget(qt.QMainWindow): # This value is used when curve is updated either internally or by user. def addCurve(self, x, y, legend=None, info=None, - replace=False, replot=None, + replace=False, color=None, symbol=None, linewidth=None, linestyle=None, xlabel=None, ylabel=None, yaxis=None, xerror=None, yerror=None, z=None, selectable=None, fill=None, resetzoom=True, - histogram=None, copy=True, **kw): + histogram=None, copy=True): """Add a 1D curve given by x an y to the graph. Curves are uniquely identified by their legend. @@ -617,15 +739,6 @@ class PlotWidget(qt.QMainWindow): False to use provided arrays. :returns: The key string identify this curve """ - # Deprecation warnings - if replot is not None: - _logger.warning( - 'addCurve deprecated replot argument, use resetzoom instead') - resetzoom = replot and resetzoom - - if kw: - _logger.warning('addCurve: deprecated extra arguments') - # This is an histogram, use addHistogram if histogram is not None: histoLegend = self.addHistogram(histogram=y, @@ -825,13 +938,13 @@ class PlotWidget(qt.QMainWindow): return legend def addImage(self, data, legend=None, info=None, - replace=False, replot=None, - xScale=None, yScale=None, z=None, + replace=False, + z=None, selectable=None, draggable=None, colormap=None, pixmap=None, xlabel=None, ylabel=None, origin=None, scale=None, - resetzoom=True, copy=True, **kw): + resetzoom=True, copy=True): """Add a 2D dataset or an image to the plot. It displays either an array of data using a colormap or a RGB(A) image. @@ -883,28 +996,6 @@ class PlotWidget(qt.QMainWindow): False to use provided arrays. :returns: The key string identify this image """ - # Deprecation warnings - if xScale is not None or yScale is not None: - _logger.warning( - 'addImage deprecated xScale and yScale arguments,' - 'use origin, scale arguments instead.') - if origin is None and scale is None: - origin = xScale[0], yScale[0] - scale = xScale[1], yScale[1] - else: - _logger.warning( - 'addCurve: xScale, yScale and origin, scale arguments' - ' are conflicting. xScale and yScale are ignored.' - ' Use only origin, scale arguments.') - - if replot is not None: - _logger.warning( - 'addImage deprecated replot argument, use resetzoom instead') - resetzoom = replot and resetzoom - - if kw: - _logger.warning('addImage: deprecated extra arguments') - legend = "Unnamed Image 1.1" if legend is None else str(legend) # Check if image was previously active @@ -1090,7 +1181,8 @@ class PlotWidget(qt.QMainWindow): def addItem(self, xdata, ydata, legend=None, info=None, replace=False, shape="polygon", color='black', fill=True, - overlay=False, z=None, **kw): + overlay=False, z=None, linestyle="-", linewidth=1.0, + linebgcolor=None): """Add an item (i.e. a shape) to the plot. Items are uniquely identified by their legend. @@ -1114,13 +1206,23 @@ class PlotWidget(qt.QMainWindow): This allows for rendering optimization if this item is changed often. :param int z: Layer on which to draw the item (default: 2) + :param str linestyle: Style of the line. + Only relevant for line markers where X or Y is None. + Value in: + + - ' ' no line + - '-' solid line + - '--' dashed line + - '-.' dash-dot line + - ':' dotted line + :param float linewidth: Width of the line. + Only relevant for line markers where X or Y is None. + :param str linebgcolor: Background color of the line, e.g., 'blue', 'b', + '#FF0000'. It is used to draw dotted line using a second color. :returns: The key string identify this item """ # expected to receive the same parameters as the signal - if kw: - _logger.warning('addItem deprecated parameters: %s', str(kw)) - legend = "Unnamed Item 1.1" if legend is None else str(legend) z = int(z) if z is not None else 2 @@ -1138,6 +1240,9 @@ class PlotWidget(qt.QMainWindow): item.setOverlay(overlay) item.setZValue(z) item.setPoints(numpy.array((xdata, ydata)).T) + item.setLineStyle(linestyle) + item.setLineWidth(linewidth) + item.setLineBgColor(linebgcolor) self._add(item) @@ -1148,8 +1253,7 @@ class PlotWidget(qt.QMainWindow): color=None, selectable=False, draggable=False, - constraint=None, - **kw): + constraint=None): """Add a vertical line marker to the plot. Markers are uniquely identified by their legend. @@ -1177,10 +1281,6 @@ class PlotWidget(qt.QMainWindow): and that returns the filtered coordinates. :return: The key string identify this marker """ - if kw: - _logger.warning( - 'addXMarker deprecated extra parameters: %s', str(kw)) - return self._addMarker(x=x, y=None, legend=legend, text=text, color=color, selectable=selectable, draggable=draggable, @@ -1192,8 +1292,7 @@ class PlotWidget(qt.QMainWindow): color=None, selectable=False, draggable=False, - constraint=None, - **kw): + constraint=None): """Add a horizontal line marker to the plot. Markers are uniquely identified by their legend. @@ -1221,10 +1320,6 @@ class PlotWidget(qt.QMainWindow): and that returns the filtered coordinates. :return: The key string identify this marker """ - if kw: - _logger.warning( - 'addYMarker deprecated extra parameters: %s', str(kw)) - return self._addMarker(x=None, y=y, legend=legend, text=text, color=color, selectable=selectable, draggable=draggable, @@ -1236,8 +1331,7 @@ class PlotWidget(qt.QMainWindow): selectable=False, draggable=False, symbol='+', - constraint=None, - **kw): + constraint=None): """Add a point marker to the plot. Markers are uniquely identified by their legend. @@ -1277,10 +1371,6 @@ class PlotWidget(qt.QMainWindow): and that returns the filtered coordinates. :return: The key string identify this marker """ - if kw: - _logger.warning( - 'addMarker deprecated extra parameters: %s', str(kw)) - if x is None: xmin, xmax = self._xAxis.getLimits() x = 0.5 * (xmax + xmin) @@ -1368,7 +1458,7 @@ class PlotWidget(qt.QMainWindow): curve = self._getItem('curve', legend) return curve is not None and not curve.isVisible() - def hideCurve(self, legend, flag=True, replot=None): + def hideCurve(self, legend, flag=True): """Show/Hide the curve associated to legend. Even when hidden, the curve is kept in the list of curves. @@ -1376,9 +1466,6 @@ class PlotWidget(qt.QMainWindow): :param str legend: The legend associated to the curve to be hidden :param bool flag: True (default) to hide the curve, False to show it """ - if replot is not None: - _logger.warning('hideCurve deprecated replot parameter') - curve = self._getItem('curve', legend) if curve is None: _logger.warning('Curve not in plot: %s', legend) @@ -1660,16 +1747,13 @@ class PlotWidget(qt.QMainWindow): return self._getActiveItem(kind='curve', just_legend=just_legend) - def setActiveCurve(self, legend, replot=None): + def setActiveCurve(self, legend): """Make the curve associated to legend the active curve. :param legend: The legend associated to the curve or None to have no active curve. :type legend: str or None """ - if replot is not None: - _logger.warning('setActiveCurve deprecated replot parameter') - if not self.isActiveCurveHandling(): return if legend is None and self.getActiveCurveSelectionMode() == "legacy": @@ -1723,15 +1807,12 @@ class PlotWidget(qt.QMainWindow): """ return self._getActiveItem(kind='image', just_legend=just_legend) - def setActiveImage(self, legend, replot=None): + def setActiveImage(self, legend): """Make the image associated to legend the active image. :param str legend: The legend associated to the image or None to have no active image. """ - if replot is not None: - _logger.warning('setActiveImage deprecated replot parameter') - return self._setActiveItem(kind='image', legend=legend) def _getActiveItem(self, kind, just_legend=False): @@ -2028,14 +2109,12 @@ class PlotWidget(qt.QMainWindow): """ return self._backend.getGraphXLimits() - def setGraphXLimits(self, xmin, xmax, replot=None): + def setGraphXLimits(self, xmin, xmax): """Set the graph X (bottom) limits. :param float xmin: minimum bottom axis value :param float xmax: maximum bottom axis value """ - if replot is not None: - _logger.warning('setGraphXLimits deprecated replot parameter') self._xAxis.setLimits(xmin, xmax) def getGraphYLimits(self, axis='left'): @@ -2049,7 +2128,7 @@ class PlotWidget(qt.QMainWindow): yAxis = self._yAxis if axis == 'left' else self._yRightAxis return yAxis.getLimits() - def setGraphYLimits(self, ymin, ymax, axis='left', replot=None): + def setGraphYLimits(self, ymin, ymax, axis='left'): """Set the graph Y limits. :param float ymin: minimum bottom axis value @@ -2057,8 +2136,6 @@ class PlotWidget(qt.QMainWindow): :param str axis: The axis for which to get the limits: Either 'left' or 'right' """ - if replot is not None: - _logger.warning('setGraphYLimits deprecated replot parameter') assert axis in ('left', 'right') yAxis = self._yAxis if axis == 'left' else self._yRightAxis return yAxis.setLimits(ymin, ymax) @@ -2192,36 +2269,6 @@ class PlotWidget(qt.QMainWindow): def _isAxesDisplayed(self): return self._backend.isAxesDisplayed() - @property - @deprecated(since_version='0.6') - def sigSetYAxisInverted(self): - """Signal emitted when Y axis orientation has changed""" - return self._yAxis.sigInvertedChanged - - @property - @deprecated(since_version='0.6') - def sigSetXAxisLogarithmic(self): - """Signal emitted when X axis scale has changed""" - return self._xAxis._sigLogarithmicChanged - - @property - @deprecated(since_version='0.6') - def sigSetYAxisLogarithmic(self): - """Signal emitted when Y axis scale has changed""" - return self._yAxis._sigLogarithmicChanged - - @property - @deprecated(since_version='0.6') - def sigSetXAxisAutoScale(self): - """Signal emitted when X axis autoscale has changed""" - return self._xAxis.sigAutoScaleChanged - - @property - @deprecated(since_version='0.6') - def sigSetYAxisAutoScale(self): - """Signal emitted when Y axis autoscale has changed""" - return self._yAxis.sigAutoScaleChanged - def setYAxisInverted(self, flag=True): """Set the Y axis orientation. @@ -2290,6 +2337,8 @@ class PlotWidget(qt.QMainWindow): :param bool flag: True to respect data aspect ratio """ flag = bool(flag) + if flag == self.isKeepDataAspectRatio(): + return self._backend.setKeepDataAspectRatio(flag=flag) self._setDirtyPlot() self._forceResetZoom() @@ -2323,8 +2372,8 @@ class PlotWidget(qt.QMainWindow): # Defaults def isDefaultPlotPoints(self): - """Return True if default Curve symbol is 'o', False for no symbol.""" - return self._defaultPlotPoints == 'o' + """Return True if the default Curve symbol is set and False if not.""" + return self._defaultPlotPoints == silx.config.DEFAULT_PLOT_SYMBOL def setDefaultPlotPoints(self, flag): """Set the default symbol of all curves. @@ -2334,7 +2383,7 @@ class PlotWidget(qt.QMainWindow): :param bool flag: True to use 'o' as the default curve symbol, False to use no symbol. """ - self._defaultPlotPoints = 'o' if flag else '' + self._defaultPlotPoints = silx.config.DEFAULT_PLOT_SYMBOL if flag else '' # Reset symbol of all curves curves = self.getAllCurves(just_legend=False, withhidden=True) @@ -2510,7 +2559,7 @@ class PlotWidget(qt.QMainWindow): elif ddict['event'] == 'mouseClicked' and ddict['button'] == 'left': self.setActiveCurve(None) - def saveGraph(self, filename, fileFormat=None, dpi=None, **kw): + def saveGraph(self, filename, fileFormat=None, dpi=None): """Save a snapshot of the plot. Supported file formats depends on the backend in use. @@ -2523,9 +2572,6 @@ class PlotWidget(qt.QMainWindow): :param str fileFormat: String specifying the format :return: False if cannot save the plot, True otherwise """ - if kw: - _logger.warning('Extra parameters ignored: %s', str(kw)) - if fileFormat is None: if not hasattr(filename, 'lower'): _logger.warning( @@ -3080,149 +3126,3 @@ class PlotWidget(qt.QMainWindow): # Only call base class implementation when key is not handled. # See QWidget.keyPressEvent for details. super(PlotWidget, self).keyPressEvent(event) - - # Deprecated # - - def isDrawModeEnabled(self): - """Deprecated, use :meth:`getInteractiveMode` instead. - - Return True if the current interactive state is drawing.""" - _logger.warning( - 'isDrawModeEnabled deprecated, use getInteractiveMode instead') - return self.getInteractiveMode()['mode'] == 'draw' - - def setDrawModeEnabled(self, flag=True, shape='polygon', label=None, - color=None, **kwargs): - """Deprecated, use :meth:`setInteractiveMode` instead. - - Set the drawing mode if flag is True and its parameters. - - If flag is False, only item selection is enabled. - - Warning: Zoom and drawing are not compatible and cannot be enabled - simultaneously. - - :param bool flag: True to enable drawing and disable zoom and select. - :param str shape: Type of item to be drawn in: - hline, vline, rectangle, polygon (default) - :param str label: Associated text for identifying draw signals - :param color: The color to use to draw the selection area - :type color: string ("#RRGGBB") or 4 column unsigned byte array or - one of the predefined color names defined in colors.py - """ - _logger.warning( - 'setDrawModeEnabled deprecated, use setInteractiveMode instead') - - if kwargs: - _logger.warning('setDrawModeEnabled ignores additional parameters') - - if color is None: - color = 'black' - - if flag: - self.setInteractiveMode('draw', shape=shape, - label=label, color=color) - elif self.getInteractiveMode()['mode'] == 'draw': - self.setInteractiveMode('select') - - def getDrawMode(self): - """Deprecated, use :meth:`getInteractiveMode` instead. - - Return the draw mode parameters as a dict of None. - - It returns None if the interactive mode is not a drawing mode, - otherwise, it returns a dict containing the drawing mode parameters - as provided to :meth:`setDrawModeEnabled`. - """ - _logger.warning( - 'getDrawMode deprecated, use getInteractiveMode instead') - mode = self.getInteractiveMode() - return mode if mode['mode'] == 'draw' else None - - def isZoomModeEnabled(self): - """Deprecated, use :meth:`getInteractiveMode` instead. - - Return True if the current interactive state is zooming.""" - _logger.warning( - 'isZoomModeEnabled deprecated, use getInteractiveMode instead') - return self.getInteractiveMode()['mode'] == 'zoom' - - def setZoomModeEnabled(self, flag=True, color=None): - """Deprecated, use :meth:`setInteractiveMode` instead. - - Set the zoom mode if flag is True, else item selection is enabled. - - Warning: Zoom and drawing are not compatible and cannot be enabled - simultaneously - - :param bool flag: If True, enable zoom and select mode. - :param color: The color to use to draw the selection area. - (Default: 'black') - :param color: The color to use to draw the selection area - :type color: string ("#RRGGBB") or 4 column unsigned byte array or - one of the predefined color names defined in colors.py - """ - _logger.warning( - 'setZoomModeEnabled deprecated, use setInteractiveMode instead') - if color is None: - color = 'black' - - if flag: - self.setInteractiveMode('zoom', color=color) - elif self.getInteractiveMode()['mode'] == 'zoom': - self.setInteractiveMode('select') - - def insertMarker(self, *args, **kwargs): - """Deprecated, use :meth:`addMarker` instead.""" - _logger.warning( - 'insertMarker deprecated, use addMarker instead.') - return self.addMarker(*args, **kwargs) - - def insertXMarker(self, *args, **kwargs): - """Deprecated, use :meth:`addXMarker` instead.""" - _logger.warning( - 'insertXMarker deprecated, use addXMarker instead.') - return self.addXMarker(*args, **kwargs) - - def insertYMarker(self, *args, **kwargs): - """Deprecated, use :meth:`addYMarker` instead.""" - _logger.warning( - 'insertYMarker deprecated, use addYMarker instead.') - return self.addYMarker(*args, **kwargs) - - def isActiveCurveHandlingEnabled(self): - """Deprecated, use :meth:`isActiveCurveHandling` instead.""" - _logger.warning( - 'isActiveCurveHandlingEnabled deprecated, ' - 'use isActiveCurveHandling instead.') - return self.isActiveCurveHandling() - - def enableActiveCurveHandling(self, *args, **kwargs): - """Deprecated, use :meth:`setActiveCurveHandling` instead.""" - _logger.warning( - 'enableActiveCurveHandling deprecated, ' - 'use setActiveCurveHandling instead.') - return self.setActiveCurveHandling(*args, **kwargs) - - def invertYAxis(self, *args, **kwargs): - """Deprecated, use :meth:`Axis.setInverted` instead.""" - _logger.warning('invertYAxis deprecated, ' - 'use getYAxis().setInverted instead.') - return self.getYAxis().setInverted(*args, **kwargs) - - def showGrid(self, flag=True): - """Deprecated, use :meth:`setGraphGrid` instead.""" - _logger.warning("showGrid deprecated, use setGraphGrid instead") - if flag in (0, False): - flag = None - elif flag in (1, True): - flag = 'major' - else: - flag = 'both' - return self.setGraphGrid(flag) - - def keepDataAspectRatio(self, *args, **kwargs): - """Deprecated, use :meth:`setKeepDataAspectRatio`.""" - _logger.warning('keepDataAspectRatio deprecated,' - 'use setKeepDataAspectRatio instead') - return self.setKeepDataAspectRatio(*args, **kwargs) |