如果百度Matlab绘制双y轴曲线,大家的答案都是使用plotyy,这里就不多说。

对于使用pcolor绘制的二维平面图形,如果想在上面叠加一个一维曲线,那么该怎么办呢?
我采用网友提供的一种方法,yyaxis right。原始案例如下:

x = linspace(15,30);
y = sin(3*x);
yyaxis left;
plot(x,y);
z = sin(3*x).*exp(0.5*x);
yyaxis right;
plot(x,z);
ylim([-150 150]);

Matlab绘制双y轴图,以pcolor为例
对于使用pcolor画的二维图形,同样可以采用这种方式。

     pcolor(x_struct,y_struct,ex);          % Plot
     shading interp;                                  %Smooth the figure.
%---------------------------------------------------------------------
     caxis([-10 10]);                %fixed  colorbar range
     load ExRWBcolorbar10;
    % load injectioncolorbar;
    colormap(mycolorbar);
    colorbar;
%--------------------------------------------------------------------
     xlabel('x(\mu m)');
     ylabel('y(\mu m)');
     %title(['The longitudinal electric field, ',' Time = ',num2str(t_now),' fs']);
     set(gca,'FontSize',18,'FontWeight','bold','LineWidth',4);
%--------------------------------------------------------------------
     yyaxis right;
     plot(x_struct,ex0,'LineWidth',2,'Color','k');
     ylabel('y(GeV/m)');

Matlab绘制双y轴图,以pcolor为例

相关文章:

  • 2022-01-13
  • 2022-12-23
  • 2021-11-27
  • 2021-09-11
  • 2023-03-27
猜你喜欢
  • 2021-08-06
  • 2022-12-23
  • 2021-05-31
  • 2021-04-24
  • 2021-12-08
  • 2021-11-28
相关资源
相似解决方案