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
271 stars 180 forks source link

PlottingConvention oddities #2014

Open creuzige opened 6 months ago

creuzige commented 6 months ago

What do you want to do?

Following up on the request in https://github.com/mtex-toolbox/mtex/issues/1952 to check the new plotting convention functions in 6.0.beta2

I ran into three issues and two questions:

Issues

  1. I was able to use the "plottingConvention" approach outlined in https://mtex-toolbox.github.io/changelog#1 to change the display axes. However, the figure area seems to default to the prior axes. I've attached the figures as generated. The first one is the original image with default plotting conventions, the second is after changing the plotting conventions

Original image with defaults:

AsImported

With updated plotting conventions:

how2plot.outOfScreen = ebsd_beta.N
how2plot.east = yvector

Rotated

  1. The import wizard still creates a script with variables
    setMTEXpref('xAxisDirection','east');
    setMTEXpref('yAxisDirection','north');

These don't seem to change the plotting conventions anymore. Maybe these should be replaced with the new commands?

  1. When I pass the 'how2plot' command in each plot function (also shown in https://github.com/mtex-toolbox/mtex/issues/1988), things behave as expected but is a bit tedious. However, if I try to store the plotting convention with an ebsd variable I get the following error:
In class 'EBSD', no set method is defined for dependent property 'plottingConvention'.  A dependent property needs a set method
to assign its value.

Error in indexing (line 97)
      ebsd = builtin('subsasgn',ebsd,s,b);

Error in EBSD_plot3D (line 70)
ebsd.plottingConvention = how2plot

The use case I found this is that the EBSD image is flipped in Y; I'm gathering because the Oxford EBSD data seems to start with 0,0 in the upper left corner with Y down...

Questions

  1. How can I view the EBSD data from a 3D perspective? My use case here is that I have a sample that I placed in a goniometer and I am applying external rotations to the EBSD sample and want to align the sample to the goniometer coordinate system.

  2. For alignment of coordinates, did the EBSD 'shift' command get converted to a vector3d as well, or is it still xy only?

What MTEX version do you use?

Using 6.0.beta2, Matlab R2022a, Mac OS 13.6.3

vtvivian commented 6 months ago

Hi creuzige,

I found this workaround for issue 3 (missing 'set' method), which is to change the ebsd.plottingConvention.east and ebsd.plottingConvention.outOfScreen fields directly:

e.g. : ebsd.plottingConvention.east= -vector3d.X; ebsd.plottingConvention.outOfScreen=vector3d.Z; % setMTEXpref('xAxisDirection','west'); % setMTEXpref('zAxisDirection','outOfPlane');

figure; plot(ebsd,ebsd.bc,ebsd.plottingConvention)

You still have to pass ebsd.plottingConvention explicitly into plot(), but for me it is convenient as it is one fewer variable to keep track of.

Re: your question 1, does this work? here is an ebsd map at a funny angle: ebsd.plottingConvention.east= -vector3d.X; ebsd.plottingConvention.outOfScreen=vector3d(-1,-1,-1); ebsd.plottingConvention

ans = plottingConvention

outOfScreen: (-1,-1,-1) north : (0,1,-1)
east : (-2,1,1)

figure; plot(ebsd,ebsd.bc,ebsd.plottingConvention)

funnyangle

Small bug I noticed: the micronbar seems to disappear when the map is rotated in this way - maybe it is drawn in a no-longer-visible position?

Vivian