Clear Filters
Clear Filters

Issue with function "annotate", when annotating a pole figure within a GUI

3 views (last 30 days)
I'm currently working on a GUI to simplify the application of a method my co-authors and I have developed. As part of the process I identify the n most common maxima in the c-axes of a collection of grains:
app.SF_1pg_0001 = calcDensity(app.vec0001,'halfwidth',app.CallingApp.HalfwidthEditField.Value*degree, 'Weights', app.CallingApp.EBSDdata_qz_Ori1p_weights);
[~,app.modes_0001] = max(app.SF_1pg_0001,'numLocal',app.NooforientationsEditField.Value);
Where app.SF_1pg_001 is a sphereical density function of the c-axis orientations (app.vec0001), and app.NooforientationsEditField.Value, is the number of maxima you want to select.
I want to then plot the points using "annotate" on a pole figure, which is allocated/plotted in app.UIAxes. The code, which works when coding in Matlab normally, is as follows:
for a = 1:1:app.NooforientationsEditField.Value;
hold(app.UIAxes);
annotate(app.modes_0001(a),'antipodal','label',num2str(a),'backgroundcolor','w', 'parent', app.UIAxes);
end
However, in the app I get the following error after only the first point is plotted:
Current plot held
Undefined function 'drawNow' for input arguments of
type 'double'.
Error in annotate (line 7)
drawNow(gcm);
When I explore the issue it appears that gcm is empty when trying to use annotate in the app, but contains the figure information when plotting in matlab nornally:
In app:
gcm =
[]
When using Matlab normally:
gcm
ans =
mtexFigure with properties:
parent: [1×1 Figure]
children: [1×1 Axes]
cBarAxis: []
innerPlotSpacing: 21
keepAspectRatio: 1
nrows: 1
ncols: 1
axisWidth: 448
axisHeight: 448
cbx: 0
cby: 0
tightInset: [8.5122e-06 1.5846 8.5122e-06 28.3600]
figTightInset: [10 10 10 10]
layoutMode: 'auto'
figSizeFactor: 0
currentAxes: [1×1 Axes]
currentId: 1
axesWidth: 468.0000
axesHeight: 497.9446
outerPlotSpacing: 10
dataCursorMenu: [1×1 ContextMenu]
I've tried to set gcm to be app.UIAxes, but that doesn't fix the problem while the data appears very differently, like so:
gcm =
UIAxes (pdf) with properties:
XLim: [-1.4708 1.4708]
YLim: [-1.4708 1.4708]
XScale: 'linear'
YScale: 'linear'
GridLineStyle: '-'
Position: [53 119 434 380]
Units: 'pixels'
Please let me know if anything needs clarification. I should mention the data I am trying to plot on the pole figure are vectors, with x/y/z co-ordinates, hence plotPDF does not work.
I would appreciate any advice the community has, as I don't see many options in the help section of MTEX. If there are other, better, fuctions that annotate I'm happy to change!
  3 Comments
Rellie
Rellie on 26 Mar 2024
Thanks! I've posted in the mtex toolbox discussion as well. I'm happy to share my code, however, its about three interlinking apps, with thousands of lines. Hence, I just pasted the key lines of code in the discussion here.
Voss
Voss on 26 Mar 2024
If you zip all the necessary code and data, upload it here, and outline the steps necessary to reproduce the problem (assume we have no prior knowledge of MTEX), then I'll take a look.

Sign in to comment.

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!