Changeset 0231f93 in sasview for src/sas/qtgui/Plotting


Ignore:
Timestamp:
Aug 31, 2018 5:55:51 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
aa1db44
Parents:
eef298d4
git-author:
Piotr Rozyczko <rozyczko@…> (08/31/18 05:55:03)
git-committer:
Piotr Rozyczko <rozyczko@…> (08/31/18 05:55:51)
Message:

Improved line colour handling for 1D data charts.

Location:
src/sas/qtgui/Plotting
Files:
2 edited

Legend:

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

    rcee5c78 r0231f93  
    274274        if 0 <= color <=6: 
    275275            color = list(COLORS.values())[color] 
    276     # Check if it's an RGB string 
    277276    elif isinstance(color, str): 
    278         # Assure the correctnes of the string 
    279         assert(color[0]=="#" and len(color) == 7) 
    280         assert(all(c in string.hexdigits for c in color[1:])) 
     277        # This could be a one letter code 
     278        if len(color) == 1: 
     279            if not color in list (COLORS.values()): 
     280                raise AttributeError 
     281        else: 
     282            # or an RGB string 
     283            assert(color[0]=="#" and len(color) == 7) 
     284            assert(all(c in string.hexdigits for c in color[1:])) 
    281285    else: 
    282286        raise AttributeError 
  • src/sas/qtgui/Plotting/Plotter.py

    r04ac604 r0231f93  
    55import functools 
    66import copy 
    7 import matplotlib.pyplot as plt 
     7import matplotlib as mpl 
    88from matplotlib.font_manager import FontProperties 
    99from sas.qtgui.Plotting.PlotterData import Data1D 
     
    126126 
    127127        color = PlotUtilities.getValidColor(color) 
     128        self.data.custom_color = color 
    128129 
    129130        markersize = self._data.markersize 
     
    162163                            picker=True) 
    163164 
     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() 
     168 
    164169        # Update the list of data sets (plots) in chart 
    165170        self.plot_dict[self._data.id] = self.data 
     
    433438        self.plot_dict = {} 
    434439 
    435         plt.cla() 
     440        mpl.pyplot.cla() 
    436441        self.ax.cla() 
    437442 
     
    496501 
    497502        # Clean the canvas 
    498         plt.cla() 
     503        mpl.pyplot.cla() 
    499504        self.ax.cla() 
    500505 
Note: See TracChangeset for help on using the changeset viewer.