Menu

Graph Inside Graph

Help
2023-02-26
2023-02-26
  • Alan Bromborsky

    Alan Bromborsky - 2023-02-26

    I have looked at the post on embedding graph and cannot understand it to help me in my problem. I wish to draw one graph inside another graph. My particular problem is I have graph of the Fourier Transform of a time function and the graph of the function of time. I want the plot the function of time inside the axes (upper right hand corner with reduced size) of the Fourier Transform graph to show in one picture the relation between the two functions. There must be a way to do this but it must use aspects of Asymptote I am not yet familiar with. Any help would be greatly appreciated. Other than the post on embedding a function all the examples I have found show how to draw multiple images on a picture that do not lie inside one another. This I was able to do.

     
  • Alan Bromborsky

    Alan Bromborsky - 2023-02-26

    I got to work with this code but I don't know why it works or how to fine tune the position of the embedded graph -

    // Square Pulse with Fourier Transform
    
    PulseGate pulse; pulse.init(T);
    
    picture pic0,pic0a,pic0b,pic1,pic2,pic3,pic4,pic5;
    
    size(pic0a,250,175,IgnoreAspect);
    draw(pic0a,graph(pic1,ScaleShift(T,pulse.f),-1,1,1000));
    
    xaxis(pic0a,"$t/T$",Bottom,Ticks);
    yaxis(pic0a,"$\f{f}{t}$",Left,Ticks,ymin=0.0,ymax=1.2);
    
    size(pic0b,600,400,IgnoreAspect);
    draw(pic0b,graph(pic0b,ScaleShift(pulse.Fabs,T),-10,10,1000));
    
    xaxis(pic0b,"$\w T$",Bottom,Ticks);
    yaxis(pic0b,"$\abs{\f{F}{\w}}$",Left,Ticks);
    
    size(pic0,600,400,IgnoreAspect);
    add(pic0,pic0a.fit(),(0,0),SW);
    add(pic0,pic0b.fit(),(0,0),SW);
    

    pdf output attached

     

Log in to post a comment.