How can I change the radius of a circle pointeur

3 次查看(过去 30 天)
Hi, I'm using the "myginput.m" function and I would like to change the radius of my circle pointer. However, I haven't succeeded. Would anybody have a or the solution ? Thank you in advance.
  2 个评论
KSSV
KSSV 2017-4-11
What is this function myginput.m? And where you want to change the pointer?
Marie BILLARD
Marie BILLARD 2017-4-11
I found myginput.m function on this link : https://fr.mathworks.com/matlabcentral/fileexchange/12770-myginput So I can change my "arrow" pointer on "circle" pointer. But I don't know how to increase the radius of this circle.

请先登录,再进行评论。

采纳的回答

Jan
Jan 2017-4-11
编辑:Jan 2017-4-12
This function can set exactly the same pointers as explained in the documentation: See doc figure "pointers" . You cannot set the radius of the circle pointer.
If you want to choose the radius freely, you need to draw the circle by your own.
[EDITED] For creating a 32x32 pointer, see the "PointerShapeCData" point in the posted link.
CData = [ ...
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1; ...
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2; ...
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 0, 0; ...
0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
LUT = [NaN, 1, 2]; % Transparent, black, white
Shape = LUT(CData + 1);
Shape = cat(2, Shape, fliplr(Shape));
Shape = cat(1, Shape, flipud(Shape));
figure('Pointer', 'custom', 'PointerShapeCData', Shape);
This is a circle with 32 pixels diameter with black pixels and a white circle inside. This is visible on light and dark images. If only the black circle is wanted, use: LUT = [NaN, 1, NaN]
Set the 'PointerShapeHotSpot' to [16, 16]. Note, that the center is not exactly at the midpoint of the circle. To get this create a circle with an odd number of pixels.

更多回答(1 个)

Thorsten
Thorsten 2017-4-11
You have to define your own pointer as a 16 x 16 matrix and then change the line in myginput that changes the pointer to use your pointer. See http://matlab.izmiran.ru/help/techdoc/creating_plots/figure12.html for details how to define a pointer.
  5 个评论
Guillaume
Guillaume 2017-4-12
编辑:Guillaume 2017-4-12
In which documentation can I find it ?
The one that comes with your copy of matlab! At least, R2017a says it can be 32x32.
At matlab command prompt:
web(fullfile(docroot, 'matlab/ref/figure-properties.html#property_d0e277605'))
Or you could just try and see if it works:
hfig = figure;
custompointer = ones(32); custompointer(2:end-1, 2:end-1) = nan; %32x32 square
hfig.Pointer = 'custom';
hfig.PointerShapeCData = custompointer;
edit: it would appear that 32x32 was added in R2016b

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by