- http://www.mathworks.com/matlabcentral/fileexchange/29276-dragzoom-drag-and-zoom-tool
- http://www.mathworks.com/matlabcentral/fileexchange/30556-popout
- http://www.mathworks.com/matlabcentral/fileexchange/2884-zoombox
- http://www.mathworks.com/matlabcentral/fileexchange/5961-magnify
Problem in exporting figure: Can anyone fix a bug in this code?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mona Mahboob Kanafi
el 19 de En. de 2014
Respondida: Felipe
el 10 de Oct. de 2017
Dear all,
I'm using this code to magnify part of my figure:
But while printing the final figure to .eps, ... the 'position magnifier' weirdly disappears from the image. Also, it creates a small black rectangle in the corner of the image (specified by a red circle in image below):
I use these settings when using the code mentioned above:
% plot
figHandler = figure;
hold on
h1 = plot(x,y);
hold off;
magnifyOnFigure(...
figHandler,...
'units', 'pixels',...
'initialPositionSecondaryAxes', [326.933 259.189 164.941 102.65],...
'initialPositionMagnifier', [120 80 60 75],...
'mode', 'interactive',...
'displayLinkStyle', 'straight',...
'edgeWidth', 2,...
'edgeColor', 'black',...
'secondaryAxesFaceColor', [1 1 1]...
);
Can anyone help me fix the bug in the original code?
Added: there is actually a bug in the code that the author couldn't fix:
% - The size and position of the magnifier are modified for % 'PaperPositionMode' equal to 'auto', when the figure is printed to file % through 'print'
Now, can anyone help me fix this?
0 comentarios
Respuesta aceptada
Jan
el 19 de En. de 2014
The concerned square is an annotation object and a child of an invisible axes, which covers the complete figure. Unfortunately this implies, that a resizing of the figure move this object differently than the axes, which contain the diagram. It would take a lot of work to synchronize the resize behaviour of the two axes objects. It seems to be much more efficient to use another tool for this zoom effect, perhaps one of these functions are useful:
Contacting the author of the On-Figure-Magnifier might be an option also.
Más respuestas (6)
Jan
el 19 de En. de 2014
Editada: Jan
el 19 de En. de 2014
I recommend to use the debugger to find the command, which causes the relocation of the graphics object. Set a breakpoint in the code for creating the PDF (you didn't mention how you do this) and step through the code line by line until the observed effect happens.
Perhaps it would be useful to attach the FIG file, such that we can reproduce your problem.
[EDITED] Please post comments to answers in the corresponding comment section.
If the prioblem appears, when the 'PaperPositionMode' is set to 'auto', set the paper position manually to the wanted value. Then the PaperPositionMode is set to 'manual' implicitly also.
0 comentarios
Mona Mahboob Kanafi
el 19 de En. de 2014
Editada: Mona Mahboob Kanafi
el 19 de En. de 2014
1 comentario
Jan
el 19 de En. de 2014
When I open this figure, several callbacks are missing. Most of all the missing ResizeFcn might be a reason for the observed behaviour.
Amit
el 19 de En. de 2014
One thing that you can do manually is once the figure is plotted. On the figure, go to File > SaveAs and save manually as pdf.
I tested it and it works. Unfortunately, saveas command does not do the same.
Ver también
Categorías
Más información sobre Interactive Control and Callbacks 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!