Probably a too special question, but just in case someone has faced a similar problem.
I am using plot2svg to get plots from Matlab to Inkscape. It works fine, except for one pretty annoying problem. If I want to show just a zoomed part of a curve, plot2svg “captures” the whole curve and then clips it. As a result, the SVG file is much larger than it could be, and sometimes Inkscape even crashes on complex curves.
What would help is some way to remove the data outside the axis before exporting SVG. I’ve tried brushing (remove unbrushed), but then plot2svg fails:
Attempted to access parts(1); index out of bounds because numel(parts)=0.
Error in plot2svg>line2svg (line 2237)
if parts(1)~=1
Error in plot2svg>axchild2svg (line 1365)
line2svg(fid,groupax,axpos,x,y,scolorname,linestyle,linewidth)
Error in plot2svg>axes2svg (line 1042)
group = axchild2svg(fid,id,axIdString,ax,group,paperpos,axchild,axpos,groupax,projection,boundingBoxAxes);
Error in plot2svg (line 221)
group=axes2svg(fid,id,ax(j),group,paperpos);
Can anyone suggest any solution? I would like to avoid using the EPS or PDF export in Matlab because their quality is much worse than that of the plot2svg.
Matlab 2011b 64bit, plot2svg 10-Nov-2010, Win 7 Pro 64.
All values of your curve that lie outside the (zoomed in) axes should be set to NaN. Matlab will not draw these points and, hence, plot2svg will not export them. However, this involves redrawing the curve after zooming.
Make sure to save a handle to your curve when plotting it:
Then zoom in on your area of interest and afterwards run the following code: