Xfig plot image (xfig example)

From Remeis-Wiki
Jump to navigation Jump to search

xfig plot image 'xfig_plot_image'

Plotimage1.png

   % Example 1: logscale
   variable x = [PI:10*PI:#100];
   variable y = [PI:5*PI:#80];
   variable IMG = sin(x) # transpose(cos(y));
   variable xf = xfig_plot_image( IMG, x*180/PI, y*180/PI;
                                         padx=0.025, pady=0.025,
                                          dx=-.5,
                                         xlog, ylog,
                                          fill=20
                                        );
   xf.render("/tmp/test.pdf");

Plotimage2.png


   % Example 2: image of Example 1 but with gaps
   variable tmp = [[1:30],[35:65],[75:115]];
   variable x = struct{ lo = tmp/11.5*PI, hi = (tmp+1)/11.5*PI };
   tmp = [[1:40],[50:90]];
   variable y = struct{ lo = tmp/18.*PI, hi = (tmp+1)/18.*PI };
   variable IMG = sin(x.lo) # transpose(cos(y.lo));
   variable xf = xfig_plot_image( IMG, x, y ; cmap="drywet");
   xf.render("/tmp/test.pdf");