MATLAB Answers

plotting of two datasets of different length with similar look as heatmaps/colormaps

1 view (last 30 days)
Julie Bentzen
Julie Bentzen on 27 Jul 2020
Answered: Chidvi Modala on 4 Aug 2020
Hi guys,
I would like to make a plot similar to what I have sketched below. I have two data sets; crystal residues and simulation residues. The sets are not of equal length therefore the vectors aren't either. When one of the residues is present in both the crystal and the simulation, i would like a mark to be placed in front of them as illustrated with e.g. Leu 307. (I can see I misplaced the square at the y-axis Ile 296; it was meant to be at Tyr 292). I have copied some of the datasets and shown below.
Residues present in the crystal:
SER 267
ASP 289
HIE 290
ILE 291
TYR 292
THR 297
THR 301
MET 304
LEU 307
Residues present in the simulation:
TYR 23
ARG 26
ASN 51
TRP 52
PRO 53
GLY 54
PHE 75
TYR 163
GLN 166
SER 167
SER 267
ILE 291
TYR 292
ILE 296
MET 304
LEU 307
I have tried to plot the two; plot(simulation,crystal), but I get the error
Error using tabular/plot
Too many input arguments.
Do any of you know how I can plot this in Matlab?
Best regards

  0 Comments

Sign in to comment.

Answers (1)

Chidvi Modala
Chidvi Modala on 4 Aug 2020
Hi,
The following piece of code might be of help to you
% This code can be optimized but it is elaborated for better understanding
crystal = {"LEU 307", 1;
"MET 304", 2;
"ILE 296", 3};
simulation = {"ASN 155", 1;
"LEU 307", 2;
"GLU 259", 3};
j =1;
for i= 1: length(simulation)
temp = find([simulation{i,1}] == [crystal{:,1}]);
if ~isempty(temp)
x(j) = i;
y(j) = temp;
j = j+1;
end
end
plot(x,y,'--gs',...
'LineWidth',2,...
'MarkerSize',20,...
'MarkerEdgeColor','g',...
'MarkerFaceColor',[.49 0.70 .63]) % You can set RGB values based on your requirement
xlim([0 length(simulation)]);
ylim([0 length(crystal)]);
xticks([1 2 3]);
yticks([1 2 3]);
xticklabels({'ASN 155','LEU 307','GLU 259'});
yticklabels({'LEU 307', 'MET 304', 'ILE 296'});
title('Interface Interactions Ec FOFO')
xlabel('MD Simulation (>80%)');
ylabel('Crystal')
You can refer to this documentation for different line properties.

  0 Comments

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!