mtex-toolbox / mtex

MTEX is a free Matlab toolbox for quantitative texture analysis. Homepage:
http://mtex-toolbox.github.io/
GNU General Public License v2.0
281 stars 185 forks source link

issue colorcoding individual orientations on a PF #143

Closed jhiscocks closed 8 years ago

jhiscocks commented 8 years ago

I tried to post this over at the forum, but the 'post' button was nonfunctional.

After plotting my EBSD data, I can plot a pole figure with the same coloration by using the following code;

oM =  ipdfHSVOrientationMapping(ebsd_scratch('Magnesium'));
color =  oM.orientation2color(ebsd_scratch('Magnesium').orientations);
figure;
  plotPDF(ebsd_scratch('Magnesium').orientations,h,'upper','projection','eangle','points',10000, 'MarkerSize',1,'property',color);

I can also select two points on the map and plot them as a pole figure using the following code

[x,y]=ginput(1);
ori1=ebsd_scratch(x,y).orientations;
[x,y]=ginput(1);
ori2=ebsd_scratch(x,y).orientations;
h=[Miller(0,0,1,ebsd_scratch('Magnesium').CS),Miller(1,0,0,ebsd_scratch('Magnesium').CS)];
figure;
plotPDF (ori1,h,'upper','projection','eangle','MarkerSize',10);
hold on;
plotPDF (ori2,h,'upper','projection','eangle','MarkerSize',10);
hold off;

however when I try to combine the two and plot the two points ori1 and ori2 with colors using the following command I get an error message

h=[Miller(0,0,1,ebsd_scratch('Magnesium').CS),Miller(1,0,0,ebsd_scratch('Magnesium').CS)];
figure;
plotPDF (ori1,h,'upper','projection','eangle','MarkerSize',1,'property',color);
hold on;
plotPDF (ori2,h,'upper','projection','eangle','MarkerSize',1,'property',color);
hold off;

This is the error message

Warning: Error creating or updating Patch
 Error in value of property  FaceVertexCData
 number of colors  must be equal to number of vertices when MarkerFaceColor is Flat
Warning: Error creating or updating Patch
 Error in value of property  FaceVertexCData
 number of colors  must be equal to number of vertices when MarkerFaceColor is Flat
Warning: Error creating or updating Patch
 Error in value of property  FaceVertexCData
 number of colors  must be equal to number of vertices when MarkerFaceColor is Flat
Warning: Error creating or updating Patch
 Error in value of property  FaceVertexCData
 number of colors  must be equal to number of vertices when MarkerFaceColor is Flat

What am I doing wrong? I would also like to be able to colorise these two points in other ways, for example using grains.meanOrientation

ralfHielscher commented 8 years ago

Hi jhiscocks,

In the most recent MTEX version the use of the property flag is obsolete. Data are always placed as the second argument to a plotting command, i.e.,

plotPDF (ori1,color,h,'upper','projection','eangle','MarkerSize',1);

I hope this helps,

Ralf.