docs: def plot2Dnet (include = ['allCells'], figSize = (12,12), view = 'xy', showConns = True, popColors = None, fontSize = 12,
                  tagsFile = None, saveData = None, saveFig = None, showFig = True): 
      ''' 
      Plot 2D representation of network cell positions and connections
          - include (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Cells to show (default: ['all'])
          - showConns (True|False): Whether to show connections or not (default: True)
          - figSize ((width, height)): Size of figure (default: (12,12))
          - view ('xy', 'xz'): Perspective view: front ('xy') or top-down ('xz')
          - popColors (dict): Dictionary with color (value) used for each population (key) (default: None)
          - saveData (None|'fileName'): File name where to save the final data used to generate the figure (default: None)
          - saveFig (None|'fileName'): File name where to save the figure;
              if set to True uses filename from simConfig (default: None)(default: None)
          - showFig (True|False): Whether to show the figure or not;
              if set to True uses filename from simConfig (default: None)
  
          - Returns figure handles
      '''
      from .. import sim
  
      print('Plotting 2D representation of network cell locations and connections...')
  
      fig = plt.figure(figsize=figSize)
  
      # front view
      if view == 'xy':
          ycoord = 'y'
      elif view == 'xz':
          ycoord = 'z'
  
      if tagsFile:
          print('Loading tags file...')
          import json
          with open(tagsFile, 'r') as fileObj: tagsTmp = json.load(fileObj)['tags']
          tagsFormat = tagsTmp.pop('format', [])
          tags = {int(k): v for k,v in tagsTmp.items()} # find method to load json with int keys?
          del tagsTmp
  
          # set indices of fields to read compact format (no keys)
          missing = []
          popIndex = tagsFormat.index('pop') if 'pop' in tagsFormat else missing.append('pop')
          xIndex = tagsFormat.index('x') if 'x' in tagsFormat else missing.append('x')
          yIndex = tagsFormat.index('y') if 'y' in tagsFormat else missing.append('y')
          zIndex = tagsFormat.index('z') if 'z' in tagsFormat else missing.append('z')
          if len(missing) > 0:
              print("Missing:")
              print(missing)
              return None, None, None 
  
          # find pre and post cells
          if tags:
              cellGids = getCellsIncludeTags(include, tags, tagsFormat)
              popLabels = list(set([tags[gid][popIndex] for gid in cellGids]))
              
              # pop and cell colors
              popColorsTmp = {popLabel: colorList[ipop%len(colorList)] for ipop,popLabel in enumerate(popLabels)} # dict with color for each pop
              if popColors: popColorsTmp.update(popColors)
              popColors = popColorsTmp
              cellColors = [popColors[tags[gid][popIndex]] for gid in cellGids]
              
              # cell locations
              posX = [tags[gid][xIndex] for gid in cellGids]  # get all x positions
              if ycoord == 'y':
                  posY = [tags[gid][yIndex] for gid in cellGids]  # get all y positions
              elif ycoord == 'z':
                  posY = [tags[gid][zIndex] for gid in cellGids]  # get all y positions
          else:
              print('Error loading tags from file') 
              return None
  
      else:
          cells, cellGids, _ = getCellsInclude(include)           
          selectedPops = [cell['tags']['pop'] for cell in cells]
          popLabels = [pop for pop in sim.net.allPops if pop in selectedPops] # preserves original ordering
          
          # pop and cell colors
          popColorsTmp = {popLabel: colorList[ipop%len(colorList)] for ipop,popLabel in enumerate(popLabels)} # dict with color for each pop
          if popColors: popColorsTmp.update(popColors)
          popColors = popColorsTmp
          cellColors = [popColors[cell['tags']['pop']] for cell in cells]
  
          # cell locations
          posX = [cell['tags']['x'] for cell in cells]  # get all x positions
          posY = [cell['tags'][ycoord] for cell in cells]  # get all y positions
      
  
      plt.scatter(posX, posY, s=60, color = cellColors) # plot cell soma positions
      posXpre, posYpre = [], []
      posXpost, posYpost = [], []
      if showConns and not tagsFile:
          for postCell in cells:
              for con in postCell['conns']:  # plot connections between cells
                  if not isinstance(con['preGid'], basestring) and con['preGid'] in cellGids:
                      posXpre,posYpre = next(((cell['tags']['x'],cell['tags'][ycoord]) for cell in cells if cell['gid']==con['preGid']), None)  
                      posXpost,posYpost = postCell['tags']['x'], postCell['tags'][ycoord] 
                      color='red'
                      if con['synMech'] in ['inh', 'GABA', 'GABAA', 'GABAB']:
                          color = 'blue'
                      width = 0.1 #50*con['weight']
                      plt.plot([posXpre, posXpost], [posYpre, posYpost], color=color, linewidth=width) # plot line from pre to post
      
      plt.xlabel('x (um)')
      plt.ylabel(ycoord+' (um)') 
      plt.xlim([min(posX)-0.05*max(posX),1.05*max(posX)]) 
      plt.ylim([min(posY)-0.05*max(posY),1.05*max(posY)])
      fontsiz = fontSize
  
      for popLabel in popLabels:
          plt.plot(0,0,color=popColors[popLabel],label=popLabel)
      plt.legend(fontsize=fontsiz, bbox_to_anchor=(1.01, 1), loc=2, borderaxespad=0.)
      ax = plt.gca()
      ax.invert_yaxis()
  
      # save figure data
      if saveData:
          figData = {'posX': posX, 'posY': posY, 'posX': cellColors, 'posXpre': posXpre, 'posXpost': posXpost, 'posYpre': posYpre, 'posYpost': posYpost,
           'include': include, 'saveData': saveData, 'saveFig': saveFig, 'showFig': showFig}
      
          _saveFigData(figData, saveData, '2Dnet')
   
      # save figure
      if saveFig: 
          if isinstance(saveFig, basestring):
              filename = saveFig
          else:
              filename = sim.cfg.filename+'_'+'2Dnet.png'
          plt.savefig(filename)
  
      # show fig 
      if showFig: _showFigure()
  
      return fig, {'include': include, 'posX': posX, 'posY': posY, 'posXpre': posXpre, 'posXpost': posXpost, 'posYpre': posYpre, 'posYpost': posYpost}