mtex icon indicating copy to clipboard operation
mtex copied to clipboard

Filled Contour Extends to Edges of PF Plot

Open creuzige opened this issue 3 years ago • 1 comments

What do you want to do? I have a series of partial pole figures, and I wanted to plot them using filled contours. Unfortunately the data from the points with the largest polar angles (tilt) extend out to the boundaries of the plot, which looks a little wrong.

What data do you have?

CrMnFeNi_23_12_20_20_111.txt

What code do you use? Please provide minimalist code with code in the following form

%Recommend you assume Triclinic (no) specimen symmetry as a default ('-1')
% 'mmm' is for orthotropic sample symmetry
SpecSym={specimenSymmetry('-1'),
    specimenSymmetry('mmm')};

%Assumed unit cells for FCC and BCC materials. Not really used in your case
CrySym = {... 
  crystalSymmetry('m-3m', [3.520 3.520 3.520], 'mineral', 'austenite', 'color', 'light blue'),
  crystalSymmetry('m-3m', [2.934 2.934 2.934], 'mineral', 'martensite', 'color', 'green')};


fname = ['CrMnFeNi_23_12_20_20_111.txt'];
pf1=loadPoleFigure_generic(fname,'HEADER',5,'degree','ColumnNames',{'polar angle','azimuth angle','intensity'},'Columns',[1 2 3]);
pf1.SS=SpecSym{1};
pf1.CS=CrySym{1};

figure(1); plot(pf1); 
print('-dpng', '-r300', "PoleFigures_Points.png")

% plot as a filled contour with fixed color range
figure(2); plot(pf1,'contourf','antipodal','smooth'); CLim(gcm,[0, 4]); mtexColorbar
print('-dpng', '-r300', "PoleFigures_FilledContour.png")

What result do you get Here's the plot as discrete points: PoleFigures_Points

Here's the plot as a filled contour PoleFigures_FilledContour

What result do you expect Is it possible to set a range that the filled contour function will not try to plot over? I'm thinking something similar to the non-convex data sets example in EBSD grain reconstruction (https://mtex-toolbox.github.io/GrainReconstruction.html)

What MTEX version do you use? Mtex 5.3

creuzige avatar Jan 15 '21 18:01 creuzige

Just a hint where the problem may be situated: this not happen on gridded polefigures such as the ptx dataset (72-by-51) since this check here: https://github.com/mtex-toolbox/mtex/blob/a8b2d20dddb17fa74b4463c1aa2b90655dd78518/geometry/%40vector3d/smooth.m#L48 doesn't turn out to be true and the normal contourf() cuts the data correctly. However it only works on a grid. In the other case, 'cutOutSide' in vector3d/interp should actually take care of that case but doesn't seem to do it right.

Uncommenting this linehttps://github.com/mtex-toolbox/mtex/blob/a8b2d20dddb17fa74b4463c1aa2b90655dd78518/geometry/%40vector3d/interp.m#L80 and comment the previous one gives me the following result which may be better - no idea when we'd need the all().

newfile

Cheers, Rüdiger

kilir avatar Jan 18 '21 20:01 kilir