Plotted text changes size when its transfered to another figure

3 次查看(过去 30 天)
I am developing an AppDesigner app that tries to automate some predefined vector drawings using UI axes. I basically have some number of boxes that I have created using polyshape and they have numbers in the middle created by using text function. However, since I have to use release 2019a, I cannot directly save uiaxes as a vector pdf, so I use a workaround that I found in community about copying all the child objects of this axes in a new invisible figure and saving that figure. However, when I copy axes childs to this figure the text size changes drastically and since I have a short but wide plot the text comes quite large in comparision with the boxes which makes exported vector unusable. Is ther any way for me to change the fontsize in this plotted text after I copied it to new figure?
As an alternative way, the toolbar in the uiaxes has an export button that works really good to export vector graphics, is there a programmatic way to activate the callback of toolbar export button? Since exportgraphics doesn't work in 2019a I couldn't able to find a way to save figures that works similarly to the export button, I am using saveas but it saves the figure in a aspect ratio that doesn't include all the data in the figure.
  4 个评论
Gunnar Zindel
Gunnar Zindel 2023-10-13
编辑:Gunnar Zindel 2023-10-13
Hi, Tek,
so, if you have the need to identify specific text objects, you might think about giving them tags using the tag property, which a text object should have if i remember that right.
You could for example tag them all as "NeedsResize" or something else before saving them and then after reloading them find the correct ones using the "findobj" - function.
Best regards
Gunnar
Tek
Tek 2023-10-16
Hello Gunnar,
Yes I guess tagging them, then reloading can work but at this point, I think it will be easier to call the function that create the graph again for the new figure, it basically does the same thing minus idetification of which text needs to be resized.
Also, I am trying to get a zoomable text in my uiaxes since I have a shape that is very wide but very short (like 240 unit wide but only 20 unit tall), and when the graph shows all the objects having a big text is not meaningful. However, when user zooms in I want to text to be visible. I have successfully modified TextZoomable(x,y,varargin) - File Exchange - MATLAB Central (mathworks.com) that code to work with uiaxes however, my listener that listen change in Xlim and Ylim limits (to capture that is user zoomed and what is the zoom ratio) is called 5760 times while user only tried to zoom for 12 times (validateAndSetLimits funtion is only called 12 times). Profiler shows the line ax.Xlim = sort(new_xlim) line in Profiler changed the Xlim 240 times for each call of the validateAndSetLimits funtion (which is the number how many text objects are present in the graph). Since I also update textsize for each change in the Xlim set handles function is called 1382400 times which took 90 seconds to execute for 12 zoom operations (115200 times for each zoom) which makes this function very slow. Do you have any suggestion to improve performance of this funtion?

请先登录,再进行评论。

回答(0 个)

类别

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

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by