diff --git a/qcodes/plots/pyqtgraph.py b/qcodes/plots/pyqtgraph.py index bfd4c2000722..1c54e75fe60e 100644 --- a/qcodes/plots/pyqtgraph.py +++ b/qcodes/plots/pyqtgraph.py @@ -527,8 +527,8 @@ def fixUnitScaling(self, startranges: Optional[Dict[str, Dict[str, Union[float,i # make a dict mapping axis labels to axis positions for axis in ('x', 'y', 'z'): if self.traces[i]['config'].get(axis): - unit = self.traces[i]['config'][axis].unit - if unit not in standardunits: + unit = getattr(self.traces[i]['config'][axis], 'unit', None) + if unit is not None and unit not in standardunits: if axis in ('x', 'y'): ax = plot.getAxis(axismapping[axis]) else: @@ -546,10 +546,10 @@ def fixUnitScaling(self, startranges: Optional[Dict[str, Dict[str, Union[float,i ax.update() # set limits either from dataset or - setarr = self.traces[i]['config'][axis].ndarray + setarr = getattr(self.traces[i]['config'][axis], 'ndarray', None) arrmin = None arrmax = None - if not np.all(np.isnan(setarr)): + if setarr and not np.all(np.isnan(setarr)): arrmax = setarr.max() arrmin = setarr.min() elif startranges is not None: @@ -557,7 +557,7 @@ def fixUnitScaling(self, startranges: Optional[Dict[str, Dict[str, Union[float,i paramname = self.traces[i]['config'][axis].full_name arrmax = startranges[paramname]['max'] arrmin = startranges[paramname]['min'] - except (IndexError, KeyError): + except (IndexError, KeyError, AttributeError): continue if axis == 'x':