code: def plot_domain_diagrams(self):
          
          # width of the circle around plot
          width=0.20
  
  
          # define color library
          cmap = plt.get_cmap('terrain')
          colors = [cmap(i) for i in numpy.linspace(0, 0.75, len(self.topology_data.universe.protein.segments))]
          domain_colors = {seg:colors[i] for i,seg in enumerate(self.topology_data.universe.protein.segments.segids.tolist())}
          for res in self.topology_data.dict_of_plotted_res:
              color = [domain_colors[res[2]],'white']
              #color = [self.colors_amino_acids[self.amino_acids[res.resname]],'white']
              plt.figure(figsize=(2.5,2.5))
              ring1,_=plt.pie([1],  radius=1-width, startangle=90, colors=color, counterclock=False)
              plt.axis('equal')
              plt.setp(ring1, width=width, edgecolor='white')
              if len(self.topology_data.universe.protein.segments)<=1:
                  #Parameters for amino diagrams without segids
                  plt.text(0,-0.4,res[0]+"\n"+res[1],ha='center',size=36, fontweight="bold")
              else:
                  #Parameters for amino diagrams with segids
                  plt.text(0,-0.22,res[0]+"\n"+res[1]+"\n"+res[2],ha='center',size=28, fontweight="bold")
              #play with the dpi
              pylab.savefig(res[1]+res[2]+".svg", dpi=300, transparent=True)
docs: Plotting domain diagrams - a ring around the residue name and id and chain id. The colors are
          determined by the chain id and are extracted from matplotlib colormap "terrain" (ver. "09.2016")
          The plot is saved as svg file with residue id and chain id as filename for more certain
          identification.