function [X Y out work] = plotRexpRpdbAllFun(sigmaData, out, work, user, conditions)

X = [];
Y = [];

noGroupInc                  = conditions.all.nGrpAtoms;
methylAtomsIncPseudo        = conditions.all.methylAtomsAndPseudo;
    
    
for j=1:length(sigmaData)
    plotData(j).avgrEff    = sigmaData(j).avgrEff;
    plotData(j).rEffij     = sigmaData(j).rEffij;
end


if user.plotIsoAnisorPdb == 1;
    
    subplot(1,1,1); hold; xlabel('rIsoExp'); ylabel('rPdb');
    w =  sprintf('rIsoExp vs. rPdb');
    title(w);
    
end

if user.plotIsoAnisorPdb == 2;

    subplot(1,1,1); hold; xlabel('rAnisoExp'); ylabel('rPdb');
    w =  sprintf('rAnisoExp vs. rPdb');
    title(w);
    
end

  for j=1:length(sigmaData)
      
      bothAtoms = [sigmaData(j).numcode.ATOMi, sigmaData(j).numcode.ATOMj];
      
% % %       if ~isnumeric(sigmaData(j).rPdb)
                 out.noPdbDistValue = out.noPdbDistValue + 1;
% % %       end
          
         %if ~isempty(sigmaData(j).structural.rPdb) && sigmaData(j).structural.rPdb ~= 0
          
          if sigmaData(j).unique == 2     %The first one of the partners
              
              out.plottedPoints = out.plottedPoints + 1;
              
                      if size(find(ismember(bothAtoms, noGroupInc)), 2) == 2
                          
                            X(j) = plotData(j).avgrEff;
                            Y(j) = sigmaData(j).structural.rPdb;
            
                            if strcmp(user.jindx, 'n') == 1   
                                plot(X(j),Y(j),'ro','MarkerSize',5);
                            elseif strcmp(user.jindx, 'y') == 1
                                text(X(j),Y(j),num2str(j),'color','r','FontSize',8,'HorizontalAlignment','center');
                            end
                      end
                      
                      
                      if  size(find(ismember(bothAtoms, 1)), 2) == 1 && size(find(ismember(bothAtoms, methylAtomsIncPseudo)), 2) == 1
                
                            X(j) = plotData(j).avgrEff;
                            Y(j) = sigmaData(j).structural.rPdb;
                          
                            if strcmp(user.jindx, 'n') == 1   
                                plot(X(j),Y(j),'bs','MarkerSize',6);
                            elseif strcmp(user.jindx, 'y') == 1
                                text(X(j),Y(j),num2str(j),'color','b','FontSize',8,'HorizontalAlignment','center');
                            end
                      end
                      
                      
                      if size(find(ismember(bothAtoms, methylAtomsIncPseudo)), 2) == 2
                          
                            X(j) = plotData(j).avgrEff;
                            Y(j) = sigmaData(j).structural.rPdb;
            
                            if strcmp(user.jindx, 'n') == 1   
                                plot(X(j),Y(j),'gp','MarkerSize',7);
                            elseif strcmp(user.jindx, 'y') == 1
                                text(X(j),Y(j),num2str(j),'color','g','FontSize',8,'HorizontalAlignment','center');
                            end
                      end
                                  
          elseif sigmaData(j).unique == 1     %NO partner
            
              out.plottedPoints = out.plottedPoints + 1;
              
                      if size(find(ismember(bothAtoms, noGroupInc)), 2) == 2
            
                            X(j) = plotData(j).rEffij;
                            Y(j) = sigmaData(j).structural.rPdb;
                          
                          if strcmp(user.jindx, 'n') == 1   
                            plot(X(j),Y(j),'r+','MarkerSize',6);
                          elseif strcmp(user.jindx, 'y') == 1
                            text(X(j),Y(j),num2str(j),'color','r','FontSize',8,'HorizontalAlignment','center');
                          end
                      end
                      
                      if size(find(ismember(bothAtoms, 1)), 2) == 1 && size(find(ismember(bothAtoms, methylAtomsIncPseudo)), 2) == 1
                    
                          X(j) = plotData(j).rEffij;
                          Y(j) = sigmaData(j).structural.rPdb;
                          
                        if strcmp(user.jindx, 'n') == 1   
                            plot(X(j),Y(j),'b+','MarkerSize',6);
                        elseif strcmp(user.jindx, 'y') == 1
                            text(X(j),Y(j),num2str(j),'color','b','FontSize',8,'HorizontalAlignment','center');
                        end
                      end
                      
                      
                      if size(find(ismember(bothAtoms, methylAtomsIncPseudo)), 2) == 2
                
                          X(j) = plotData(j).rEffij;
                          Y(j) = sigmaData(j).structural.rPdb;
                          
                        if strcmp(user.jindx, 'n') == 1   
                            plot(X(j),Y(j),'g+','MarkerSize',6);
                
                        elseif strcmp(user.jindx, 'y') == 1
                            text(X(j),Y(j),num2str(j),'color','g','FontSize',8,'HorizontalAlignment','center');
                        end
                      end
                      
          end
         %end
  end
  
  out.slopeRexpRpdb = Y/X;
  
  if min(X) < min(Y)
    minvalue = min(X);
  else
    minvalue = min(Y);
  end
  
  if max(X) > max(Y)
    maxvalue = max(X);
  else
    maxvalue = max(Y);
  end
 
  axis([minvalue maxvalue  minvalue  maxvalue])
  
  hline = refline(1,0);
  set(hline,'Color','k','LineWidth',0.5)
  
end