Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7823501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:16:12+00:00 2026-06-02T08:16:12+00:00

Probably a too special question, but just in case someone has faced a similar

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T08:16:14+00:00Added an answer on June 2, 2026 at 8:16 am

    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:

    figure(1)  
    h = plot(yourXdata, yourYdata);
    

    Then zoom in on your area of interest and afterwards run the following code:

    figure(1)
    hold on  
    myXlim = xlim;  
    myYlim = ylim;  
    
    % crop your data  
    yourXdata(yourXdata < myXlim(1)) = NaN;  
    yourXdata(yourXdata > myXlim(2)) = NaN;  
    
    yourYdata(yourYdata < myYlim(1)) = NaN;  
    yourYdata(yourYdata > myYlim(2)) = NaN;  
    
    % delete old curve and draw the new one  
    delete(h);
    plot(yourXdata, yourYdata);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Probably I'm just too dump for googling, but I always thought char arrays get
this is probably too simple of a question, but here I go. I have
It is probably just too late, but I cant wrap my head around what
Probably something simple, but heres my problem, I have implememnted a simple captcha into
I am probably trying to accomplish too much in a single query, but have
This is probably too basic but I'm unable to figure out how this is
This is probably too simple, but the object syntax is getting to me. I
I assume that there is probably no satisfactory answer to this question, but I
This probably has probably been asked before, but I couldn't find anything relevant. Would
I'm just curious about this, as it's probably too much trouble to be worth

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.