Rank: 143134 based on 0 downloads (last 30 days) and 0 file submitted
Personal Profile:

Graduate student in chemical engineering. I use MATLAB extensively for data processing and presentation.

Professional Interests:
chemical engineering, electrochemistry

 

Watch this Author's files

 

Comments and Ratings by Jonathon
Updated File Comments Rating
03 Aug 2011 Scalable Vector Graphics (SVG) Export of Figures Converts 3D and 2D MATLAB plots to the scalable vector format (SVG). Author: Juerg Schwizer

Bug report, with a proposed fix:
Legend text "drifts" down and left in SVG's with repeated calls to plot2svg on the same plot. This also affects the plot in MATLAB when it gets redrawn (try maximize + restore on the window).

It is caused by converting the text units to 'Data' on line 2311. Converting between the 'Data' and 'normalized' units will cause the text position value to gradually change (this can be checked by comparing get(text_handle, 'Position') before and after repeated calls to set(text_handle, 'Units', 'data') and set(text_handle, 'Units', 'normalized')).

Proposed fix: keep track of the original position in addition to the original units:
@@ -2305,6 +2305,7 @@
function text2svg(fid,group,axpos,paperpos,id,ax,projection)
global PLOT2SVG_globals;
originalTextUnits=get(id,'Units');
+originalTextPosition = get(id, 'Position');
if PLOT2SVG_globals.octave
set(id,'Units','data');
else
@@ -2363,6 +2364,7 @@
label2svg(fid,group,axpos,id,x,y,'',textalign,textrot,textvalign,lines,paperpos,font_color,0)
end
set(id,'Units',originalTextUnits);
+set(id,'Position', originalTextPosition);

Contact us