Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Plotting/Plotter.py

    r0231f93 rb764ae5  
    66import copy 
    77import matplotlib as mpl 
     8import numpy as np 
    89from matplotlib.font_manager import FontProperties 
    910from sas.qtgui.Plotting.PlotterData import Data1D 
     
    130131        markersize = self._data.markersize 
    131132 
     133        # Include scaling (log vs. linear) 
     134        ax.set_xscale(self.xscale, nonposx='clip') 
     135        ax.set_yscale(self.yscale, nonposy='clip') 
     136 
     137        # define the ranges 
     138        self.setRange = SetGraphRange(parent=self, 
     139            x_range=self.ax.get_xlim(), y_range=self.ax.get_ylim()) 
     140 
    132141        # Draw non-standard markers 
    133142        l_width = markersize * 0.4 
     
    151160                        linestyle='', label=self._title, picker=True) 
    152161            else: 
     162                dy = self._data.view.dy 
     163                # Convert tuple (lo,hi) to array [(x-lo),(hi-x)] 
     164                if dy is not None and type(dy) == type(()): 
     165                    dy = np.vstack((y - dy[0], dy[1] - y)).transpose() 
     166 
    153167                line = ax.errorbar(x, y, 
    154                             yerr=self._data.view.dy, xerr=None, 
     168                            yerr=dy, 
     169                            xerr=None, 
    155170                            capsize=2, linestyle='', 
    156171                            barsabove=False, 
     
    161176                            xlolims=False, xuplims=False, 
    162177                            label=self._title, 
     178                            zorder=1, 
    163179                            picker=True) 
    164  
    165         # Now we know what the potential new color is, let's save it 
    166         if isinstance(line, mpl.lines.Line2D): 
    167             self.data.custom_color = line.get_color() 
    168180 
    169181        # Update the list of data sets (plots) in chart 
     
    183195            ax.set_xlabel(self.x_label) 
    184196 
    185         # Include scaling (log vs. linear) 
    186         ax.set_xscale(self.xscale) 
    187         ax.set_yscale(self.yscale) 
    188  
    189         # define the ranges 
    190         self.setRange = SetGraphRange(parent=self, 
    191             x_range=self.ax.get_xlim(), y_range=self.ax.get_ylim()) 
    192  
    193197        # refresh canvas 
    194198        self.canvas.draw_idle() 
     199        # This is an important processEvent. 
     200        # This allows charts to be properly updated in order 
     201        # of plots being applied. 
     202        QtWidgets.QApplication.processEvents() 
    195203 
    196204    def createContextMenu(self): 
Note: See TracChangeset for help on using the changeset viewer.