original_docstring: Plots either source or target factor image in provided subplot.
docstring: Plots either source or target factor image in provided subplot.
docstring_tokens: Plots either source or target factor image in provided subplot .
code: def create_plot_im(ax, img, overlay, testname, target=True):
      '''Plots either source or target factor image in provided subplot.'''
      #Set colormap range
      imgMax = 0
      if(target and testname == 'top_view'):
          imgMax = .4
      elif(target):
          imgMax = .12
      elif((not target) and testname =='top_view'):
          imgMax = .131
      else:
          imgMax = .057
      imgMin = np.nanmin(img)
      colormapLimit = max(np.abs(imgMin), np.abs(imgMax)) * 0.9
  
      #Include blue in colormap if any values are negative
      if(imgMin < 0):
          im = ax.imshow(img, cmap=ListedColormap(palettable.colorbrewer.diverging.RdBu_11_r.mpl_colors))
          im.set_clim(-colormapLimit,colormapLimit)
  
      #Include reds in colormap when values are nonnegative
      else:
          ylim = ax.get_ylim()
          xlim = ax.get_xlim()
          extent = xlim + ylim
  
          ax.set_facecolor("lavender")
          if(testname == 'top_view'):
              im = ax.imshow(img, cmap="Reds", extent=extent, zorder=1)
              ax.imshow(overlay, extent=extent, zorder=10)
          else:
              im = ax.imshow(img, cmap="Reds", zorder=1)
  
          im.set_clim(0,colormapLimit)
  
      ax.axes.get_xaxis().set_visible(False)
      ax.axes.get_yaxis().set_visible(False)
      divider = make_axes_locatable(ax)
  
      cax = divider.append_axes('right', size=0.25, pad=0.05)
      cbar = plt.colorbar(im, cax=cax)
      cbar.set_ticks([])
      return im
code_tokens: def create_plot_im ( ax , img , overlay , testname , target = True ) : imgMax = 0 if ( target and testname == 'top_view' ) : imgMax = .4 elif ( target ) : imgMax = .12 elif ( ( not target ) and testname == 'top_view' ) : imgMax = .131 else : imgMax = .057 imgMin = np . nanmin ( img ) colormapLimit = max ( np . abs ( imgMin ) , np . abs ( imgMax ) ) * 0.9 if ( imgMin < 0 ) : im = ax . imshow ( img , cmap = ListedColormap ( palettable . colorbrewer . diverging . RdBu_11_r . mpl_colors ) ) im . set_clim ( - colormapLimit , colormapLimit ) else : ylim = ax . get_ylim ( ) xlim = ax . get_xlim ( ) extent = xlim + ylim ax . set_facecolor ( "lavender" ) if ( testname == 'top_view' ) : im = ax . imshow ( img , cmap = "Reds" , extent = extent , zorder = 1 ) ax . imshow ( overlay , extent = extent , zorder = 10 ) else : im = ax . imshow ( img , cmap = "Reds" , zorder = 1 ) im . set_clim ( 0 , colormapLimit ) ax . axes . get_xaxis ( ) . set_visible ( False ) ax . axes . get_yaxis ( ) . set_visible ( False ) divider = make_axes_locatable ( ax ) cax = divider . append_axes ( 'right' , size = 0.25 , pad = 0.05 ) cbar = plt . colorbar ( im , cax = cax ) cbar . set_ticks ( [ ] ) return im
short_docstring: Plots either source or target factor image in provided subplot.
short_docstring_tokens: Plots either source or target factor image in provided subplot .
comment: '''Plots either source or target factor image in provided subplot.'''$SEP$#Set colormap range$SEP$#Include blue in colormap if any values are negative$SEP$#Include reds in colormap when values are nonnegative