Xfig plot colormap (xfig example)
Jump to navigation
Jump to search
xfig plot image wih colormap 'xfig_plot_colormap'
% 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,
W=14, H=10,
colorscale,box,label="label"
);
variable cs = xfig_plot_colormap( IMG ; orientation=0, W=1,H=10,label="label");
xf = xfig_new_hbox_compound( xf, cs, 1 );
xf.render("/tmp/test.pdf");
% 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" );
variable cs1 = xfig_plot_colormap( IMG ; cmap="drywet",
W=.2*[xf.get_bbox()][1],
H = .05*[xf.get_bbox()][3],
box, label="label"
);
xf.add_object(cs1, .95, .05, .5, -.5 ; world00 );
xf.render("/tmp/test.pdf");

