function draw_clusters(filename, idx_filename, m_onpage, n_onpage, ymax) %% draw clusters as figures disp ('loading data.'); [dd,vv,cc] = tblread(filename, '\t'); [mm,nn] = size(dd); [d,v,c] = tblread(idx_filename, '\t'); [m,n] = size(d); %% draw each cluster in order specified by index total_on_pages = 1; for i = 1:0 %% don't want to print them subplot(m_onpage,n_onpage,total_on_pages); dp = dd(colon(d(i,1),d(i,2)),:); dp = transpose(dp(:,2:nn)); plot(dp); %% xlabel('conditions'); ylabel('intensity'); title(c(i,:)); set(gca,'YLim',[-ymax ymax]); set(gca,'XLim',[1 10]); set(gca,'XTickLabel',''); total_on_pages = total_on_pages + 1; if (total_on_pages > (m_onpage * n_onpage)) figure; total_on_pages = 1; %% restart end end %% draw each cluster in order specified by index %% means only figure; total_on_pages = 1; for i = 1:m %% padding %% m_onpage, n_onpage mwidth = 0.9 / m_onpage; mheight = 0.9 / n_onpage; mcoord = mod(total_on_pages - 1,m_onpage); ncoord = (total_on_pages - 1 - mcoord) / m_onpage; %%disp(strcat(num2str(mcoord * mwidth), ':', num2str(ncoord*mheight))); subplot('Position', [mcoord * mwidth + 0.1,1 - (ncoord + 1) * mheight - 0.03, mwidth*0.65, mheight*0.65]); dp = dd(colon(d(i,1),d(i,2)),:); sd = std(dp(:,2:nn)); dp = mean(dp(:,2:nn)); xpt = linspace(1,nn -1, nn-1); axis([0 (nn + 1) -3 3]); plot(xpt, transpose(dp), 'b-', xpt, transpose(dp-sd), 'r-', xpt, transpose(dp+sd), 'r-', xpt, transpose(dp), 'b.'); xlabel('conditions','FontSize',8); ylabel('s.d. from mean','FontSize',8); title(strcat('cluster ', c(i,:)), 'FontSize', 8, 'Color', 'b'); set(gca,'YLim',[-ymax ymax]); set(gca,'XLim',[0.5 (nn - 0.5)]); set(gca,'XTickLabel',''); total_on_pages = total_on_pages + 1; if (total_on_pages > (m_onpage * n_onpage)) figure; total_on_pages = 1; %% restart end end