Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ Notable changes to ORTools are listed here. The format follows
- Documentation dependencies are pinned in `docs/requirements.txt`.

### Fixed
- `plotMap_KSvariantPairs` with `parentGrainId` shows only the chosen parent grain instead of the
whole map in grey.
- `plotMap_blockWidths` draws the mean of the projected points as lines again and no longer marks
every grain centre (MTEX 7 defaults).
- `plotPDF_variants`, `plotPDF_packets` and `plotPDF_bain` use one colour per Id in the colorbar,
as the corresponding maps do.
- Broken links to examples 1 and 2 in the documentation.
- `plotCrystal_OR` help text named the wrong function and input.

Expand Down
14 changes: 14 additions & 0 deletions docs/function_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,20 @@ This function is a GUI to to define an orientation relationship (OR) with parall
<img src="../images/guiOR.png" alt="UI of guiOR" width="600"/>
</p>

## L

### <a id="liftAboveMap"></a>liftAboveMap

This auxiliary function lifts arrows drawn with *quiver(grains,...)* slightly towards the viewer. MTEX 7 draws these arrows in 3D, so arrows lying in the plane of the map would otherwise be hidden by the map itself.

- Syntax
- h = liftAboveMap(h,grains)
- Input
- h - handle(s) returned by quiver(grains,...)
- grains - @grain2d passed to quiver
- Output
- h - the same handle(s)

## O

### <a id="orientationMaker"></a>orientationMaker
Expand Down
12 changes: 8 additions & 4 deletions src/microstructureHierarchy/computeHabitPlane.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@
pIds = pGrainId(isTrace);
cIds = cGrains(ismember(idx(:, 1), pIds) & cGrains.variantId == ii).id;
[~, idxTraces] = ismember(job.mergeId(cIds), pGrainId);
q = quiver(cGrains(ismember(cGrains.id, cIds)), traces.child(idxTraces, ii), 'color', linecolor);
q = quiver(cGrains(ismember(cGrains.id, cIds)), traces.child(idxTraces, ii), 'color', linecolor, 'noMarker');
liftAboveMap(q, cGrains(ismember(cGrains.id, cIds)));
q.ShowArrowHead = 'off'; q.Marker = 'none';
end
colorbar;
Expand Down Expand Up @@ -162,7 +163,8 @@
plot(cEBSD(ismember(cEBSD.id, cIds)), repmat(cmap(ii, :), [length(cIds) 1]));
hold all
[~, mP] = plot(pGrains.boundary);
q = quiver(pGrains(ismember(pGrains.id, unique(pIds))), traces.child(unique(idxTraces), ii), 'color', linecolor);
q = quiver(pGrains(ismember(pGrains.id, unique(pIds))), traces.child(unique(idxTraces), ii), 'color', linecolor, 'noMarker');
liftAboveMap(q, pGrains(ismember(pGrains.id, unique(pIds))));
q.ShowArrowHead = 'off'; q.Marker = 'none';
hold off
set(figH, 'Name', strcat(['Variant ', num2str(ii)]), 'NumberTitle', 'on');
Expand Down Expand Up @@ -274,7 +276,8 @@
pIds = pGrainId(isTrace);
cIds = cGrains(ismember(idx(:, 1), pIds) & cGrains.variantId == ii).id;
[~, idxTraces] = ismember(job.mergeId(cIds), pGrainId);
q = quiver(cGrains(ismember(cGrains.id, cIds)), traces.imagePlane(idxTraces, ii), 'color', linecolor);
q = quiver(cGrains(ismember(cGrains.id, cIds)), traces.imagePlane(idxTraces, ii), 'color', linecolor, 'noMarker');
liftAboveMap(q, cGrains(ismember(cGrains.id, cIds)));
q.ShowArrowHead = 'off'; q.Marker = 'none';
end
hold off
Expand Down Expand Up @@ -336,7 +339,8 @@
isTrace = ~isnan(traces.imagePlane(:, ii));
pIds = pGrainId(isTrace);
[~, idxTraces] = ismember(pIds, pGrainId);
q = quiver(pGrains(ismember(pGrains.id, unique(pIds))), traces.imagePlane(unique(idxTraces), ii), 'color', linecolor);
q = quiver(pGrains(ismember(pGrains.id, unique(pIds))), traces.imagePlane(unique(idxTraces), ii), 'color', linecolor, 'noMarker');
liftAboveMap(q, pGrains(ismember(pGrains.id, unique(pIds))));
q.ShowArrowHead = 'off'; q.Marker = 'none';
hold off
set(figH, 'Name', strcat(['Variant ', num2str(ii)]), 'NumberTitle', 'on');
Expand Down
9 changes: 7 additions & 2 deletions src/microstructureHierarchy/plotMap_KSvariantPairs.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
if pGrainId
[grainsTemp, ebsdTemp] = computeVariantGrains(job, 'parentGrainId', pGrainId);
pGrain = job.parentGrains(job.parentGrains.id == pGrainId);
% Only show the map data of the chosen parent grain
ebsdTemp = ebsdTemp(ismember(ebsdTemp.id, job.ebsd(pGrain).id));
else
warning('Argument ''parentGrainId'' not specified. Equivalent variant pairs will be calculated for the EBSD map.');
[grainsTemp, ebsdTemp] = computeVariantGrains(job);
Expand Down Expand Up @@ -127,8 +129,11 @@
if ~isempty(varargin) && any(strcmpi(varargin, 'parentGrainId'))
plot(pGrain.boundary, varargin{:}, 'linecolor', [0.45 0.45 0.45], varargin{:});
end
[hL(end + 1), mP] = plot(job.grains.boundary, varargin{:});
hL(end).FaceColor = 'k';
% With a parent grain, only its own outline (above) is drawn
if isempty(pGrainId)
[hL(end + 1), mP] = plot(job.grains.boundary, varargin{:});
hL(end).FaceColor = 'k';
end
hold off
legend
set(figH, 'Name', 'Map: Equivalent variant pair Boundaries', 'NumberTitle', 'on');
Expand Down
10 changes: 7 additions & 3 deletions src/microstructureHierarchy/plotMap_blockWidths.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,13 @@
if length(pGrainId) == 1
[~, mP] = plot(cGrains, dBlock, varargin{:});
hold all
ha(1) = quiver(squeeze(cGrains), squeeze(cross(zz, zvector)), 'color', [1 0 0]);
ha(2) = quiver(squeeze(cGrains), squeeze(zz), 'color', [0 1 0]);
ha(3) = quiver(squeeze(cGrains), squeeze(new_A_vec), 'color', [0 0 1]);
% MTEX 7 marks the grain centres by default ('noMarker' switches that
% off) and hides arrows lying in the map plane (liftAboveMap); the
% mean of the projected points is an axis, drawn as a line
ha(1) = quiver(squeeze(cGrains), squeeze(cross(zz, zvector)), 'color', [1 0 0], 'noMarker');
ha(2) = quiver(squeeze(cGrains), squeeze(zz), 'color', [0 1 0], 'noMarker');
ha(3) = quiver(squeeze(cGrains), squeeze(new_A_vec), 'color', [0 0 1], 'noMarker', 'antipodal');
liftAboveMap(ha, squeeze(cGrains));
legend(ha, '$111_a {\parallel} 011_m$ trace', '$111_a {\parallel} 011_m$ normal', 'Mean of projected points')
else
for ii = 1:length(cGrains)
Expand Down
6 changes: 4 additions & 2 deletions src/microstructureHierarchy/plotPDF_bain.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ function plotPDF_bain(job, varargin)

% Define the maximum number of color levels and plot the colorbar
maxColors = max(bainIds);
% One colour per Id, as in the maps
cmap = cmap(round(linspace(1, size(cmap, 1), maxColors)), :);
colormap(cmap);
caxis([1 maxColors]);
caxis([0.5 maxColors + 0.5]);
colorbar('location', 'eastOutSide', 'LineWidth', 1.25, 'TickLength', 0.01, ...
'YTick', [1:1:maxColors], ...
'YTickLabel', num2str([1:1:maxColors]'), 'YLim', [1 maxColors], ...
'YTickLabel', num2str([1:1:maxColors]'), 'YLim', [0.5 maxColors + 0.5], ...
'TickLabelInterpreter', 'latex', 'FontName', 'Helvetica', 'FontSize', 14, 'FontWeight', 'bold');
hold on

Expand Down
6 changes: 4 additions & 2 deletions src/microstructureHierarchy/plotPDF_packets.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ function plotPDF_packets(job, varargin)

% Define the maximum number of color levels and plot the colorbar
maxColors = max(packIds);
% One colour per Id, as in the maps
cmap = cmap(round(linspace(1, size(cmap, 1), maxColors)), :);
colormap(cmap);
caxis([1 maxColors]);
caxis([0.5 maxColors + 0.5]);
colorbar('location', 'eastOutSide', 'LineWidth', 1.25, 'TickLength', 0.01, ...
'YTick', [1:1:maxColors], ...
'YTickLabel', num2str([1:1:maxColors]'), 'YLim', [1 maxColors], ...
'YTickLabel', num2str([1:1:maxColors]'), 'YLim', [0.5 maxColors + 0.5], ...
'TickLabelInterpreter', 'latex', 'FontName', 'Helvetica', 'FontSize', 14, 'FontWeight', 'bold');
hold on

Expand Down
6 changes: 4 additions & 2 deletions src/microstructureHierarchy/plotPDF_variants.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ function plotPDF_variants(job, varargin)

% Define the maximum number of color levels and plot the colorbar
maxColors = length(oriVariants);
% One colour per Id, as in the maps
cmap = cmap(round(linspace(1, size(cmap, 1), maxColors)), :);
colormap(cmap);
caxis([1 maxColors]);
caxis([0.5 maxColors + 0.5]);
colorbar('location', 'eastOutSide', 'LineWidth', 1.25, 'TickLength', 0.01, ...
'YTick', [1:1:maxColors], ...
'YTickLabel', num2str([1:1:maxColors]'), 'YLim', [1 maxColors], ...
'YTickLabel', num2str([1:1:maxColors]'), 'YLim', [0.5 maxColors + 0.5], ...
'TickLabelInterpreter', 'latex', 'FontName', 'Helvetica', 'FontSize', 14, 'FontWeight', 'bold');
hold on

Expand Down
31 changes: 31 additions & 0 deletions src/util/liftAboveMap.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function h = liftAboveMap(h, grains)
%% Function description:
% This function lifts arrows drawn with "quiver(grains,...)" slightly
% towards the viewer. MTEX 7 draws these arrows in 3D, so arrows lying
% in the plane of the map are hidden by the map itself and only their
% heads remain visible.
%
%% Syntax:
% h = liftAboveMap(h,grains)
%
%% Input:
% h - handle(s) returned by quiver(grains,...)
% grains - @grain2d passed to quiver
%
%% Output:
% h - the same handle(s)

if isempty(h), return; end

outOfScreen = grains.how2plot.outOfScreen;
ax = ancestor(h(1), 'axes');
dz = 0.01 * max(diff(ax.XLim), diff(ax.YLim)) * outOfScreen.z;
for ii = 1:numel(h)
if isprop(h(ii), 'ZData')
if isempty(h(ii).ZData)
h(ii).ZData = zeros(size(h(ii).XData));
end
h(ii).ZData = h(ii).ZData + dz;
end
end
end
Loading