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
292 stars 186 forks source link

Subplot including both orientation map and ipdf #244

Closed adrianler closed 7 years ago

adrianler commented 7 years ago

Dear all,

I'm trying to make a subplot to include both the orientation map and the ipdf. I have tried different combinations, but they all seem to overlap the figures, instead of stacking them side-by-side. Is this a bug or just me not beeing sufficiently good at programming? And are there any workarounds?

Code as follows.

oM = ipdfHSVOrientationMapping(ebsd('Aluminum'));
colour = oM.orientation2color(ebsd('Aluminum').orientations);

subplot(1,2,1)
plot(ebsd,colour)
subplot(1,2,2)
plot(oM)

Cheers!

ralfHielscher commented 7 years ago

Hi Adrian,

in general MTEX plots use their own subplot concept. It works like this

% plot the ebsd map
plot(ebsd,colour)

% get a handle of the current figure
mtexFig = gcm

% plot the color key
plot(oM,'parent',mtexFig.nextAxis)

If you want Matlab subplot you have to do it like this

ax1 = subplot(1,2,1)
plot(ebsd,colour,'parent',ax1)

ax2 = subplot(1,2,2)
plot(oM,'parent',ax2)

Note, there was a bug which preventing to plot the color key into a given axis. This has been corrected upstream. Are you able to apply this small changes to your installation? Check out the commit mentioned directly above.

Ralf

adrianler commented 7 years ago

Dear Ralf,

I implemented the changes and it now works as a charm!

Cheers!