Sfoglia il codice sorgente

better printout of the polar plots

Fernando Pablo Lopez-Lezcano 10 anni fa
parent
commit
982a736a38
1 ha cambiato i file con 42 aggiunte e 5 eliminazioni
  1. 42 5
      sphear_bf_plot.m

+ 42 - 5
sphear_bf_plot.m

@@ -26,12 +26,21 @@
 %%  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 function [BF] = sphear_bf_plot(BF, fmin, fmax, rmax)
-  pkg load signal;
+
+  if (!exist("plot_on"))
+    plot_on = "eps";
+  else
+    if (plot_on == 1)
+      plot_on = "eps"
+    end
+  end
 
   %% to close the polar plots we repeat the first point
   m = size(BF, 1);
+  n = 32;
   BF(m + 1,:) = BF(1,:);
   theta = (0:m)*(2*pi/m);
+  thetaf = (0:n)*(2*pi/n);
   
   %% plot it as a function of angle
   bname = cellstr(['W'; 'X'; 'Y'; 'Z']);
@@ -40,15 +49,43 @@ function [BF] = sphear_bf_plot(BF, fmin, fmax, rmax)
   for b = 1:4
     subplot(2, 2, b);
     hold on;
+    grid off;
     axis square;
     axis([-rmax, rmax, -rmax, rmax]);
+    ca=get (gcf, "currentaxes");
+    set(ca,"fontweight","bold","linewidth",1.5)
     title([char(bname(b)) ": " sprintf("%05.0d", fmin) " to " sprintf("%05.0d", fmax) " Hz"]);
 
-    [xr, yr] = pol2cart(theta', ones(m + 1,1));
-    plot(xr, yr);
+    if (strcmp(plot_on, "epsc") || strcmp(plot_on, "pngc"))
+      %% color plot
+      dopts = '.-r';
+      ropts = '-b';
+      copt = '-color';
+      cext = "_color";
+    else
+      %% mono plot
+      dopts = '.-';
+      ropts = '-';
+      copt = '-mono';
+      cext = "_mono";
+    end
+
+    grey = [0.1, 0.1, 0.1];
+    %% radius circles
+    for rad = 0.25:0.25:rmax
+      [xr, yr] = pol2cart(thetaf', ones(n + 1,1) * rad);
+      plot(xr, yr, ':', 'Color', grey);
+    end
+    %% radial lines
+    for ang = theta
+      plot([0 rmax*cos(ang)], [0 rmax*sin(ang)], ':', 'Color', grey);
+    end
+
+    [xr, yr] = pol2cart(thetaf', ones(n + 1,1));
+    plot(xr, yr, ropts);
     [x, y] = pol2cart(theta', abs(BF(:,b)));
-    plot(x, y, '.-r', 'LineWidth', 0.5);
+    plot(x, y, dopts, 'linewidth', 1.5, 'markersize', 6);
   end
-  print(f, '-dpng','-color',["figures/sphear_polar_multi_" sprintf("%05d", fmin) "_" sprintf("%05d", fmax) ".png"]);
+  print(f, '-deps','-tight',copt,["figures/sphear_polar_multi_" sprintf("%05d", fmin) "_" sprintf("%05d", fmax) cext ".eps"]);
 end