How can I change the radius of a circle pointeur

2 visualizaciones (últimos 30 días)
Marie BILLARD
Marie BILLARD el 11 de Abr. de 2017
Comentada: Marie BILLARD el 12 de Abr. de 2017
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 comentarios
KSSV
KSSV el 11 de Abr. de 2017
What is this function myginput.m? And where you want to change the pointer?
Marie BILLARD
Marie BILLARD el 11 de Abr. de 2017
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.

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 11 de Abr. de 2017
Editada: Jan el 12 de Abr. de 2017
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.

Más respuestas (1)

Thorsten
Thorsten el 11 de Abr. de 2017
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 comentarios
Guillaume
Guillaume el 12 de Abr. de 2017
Editada: Guillaume el 12 de Abr. de 2017
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
Marie BILLARD
Marie BILLARD el 12 de Abr. de 2017
Thank you for your help @Guillaume

Iniciar sesión para comentar.

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by