Controlling certain parameters of a two y-axes plot
    6 ビュー (過去 30 日間)
  
       古いコメントを表示
    
Hi there,
I am plotting a graph that has two y-axes:

However, I need to control certain parameters of this graph. For example, I need to change the ticklengths but the 
set(gcf,'TickLength',[.014 .014]);
line is not working. Also, I would like to change the plot colors. I do not like the default colors assigned by matlab. How should I do that? Thanks in advance
The codes and files are attached herewith:
clc; clear all;
load output;
load gain;
load SPR_gain;
yyaxis left
p1=plot(lambda*1e9,G,'linewidth',3);
xlabel('Wavelength \rm(nm)'), ylabel('Gain \rm(dB)');
xlim([770 920]);ylim([0 25]);
legend boxoff;
yyaxis right
p2=plot(l*1e9,T_gain*1e15,'-',l*1e9,T_op*1e15,'-.','linewidth',2.5);
set(gcf,'renderer','painters');
ylabel('Intensity \rm(\muW/cm^2)');
xlim([770 920]); ylim([0 4]);
legend({'Gain Lineshape of IR-140','SPP mode and hole scattering','Output Emission'},'Position',[0.34 0.71 0.08 0.08],'FontSize',18);
FS='Fontsize';
fs=20;
FN='Fontname';
fn='Times New Roman';
set(findall(gcf,'type','axes'),FS,fs,FN,fn);
set(findall(gcf,'type','text'),FS,fs,FN,fn);
% set(gcf,'TickLength',[.014 .014]);
set(gcf,'renderer','painters');
grid off
x0=100;
y0=100;
width=700;
height=500;
set(gcf,'units','pixels','position',[x0,y0,width,height]);
% print -depsc spectral_decomp.eps;
0 件のコメント
採用された回答
  Star Strider
      
      
 2020 年 2 月 4 日
        Use gca, not gcf.  
3 件のコメント
  Star Strider
      
      
 2020 年 2 月 4 日
				Experiment with this in your code: 
x = 1:10;
y1 = rand(1, 10);
y2 = rand(1, 10)+1;
figure
yyaxis left;
plot(x, y1)
AxL  = gca;
yyaxis right
plot(x, y2)
AxR = gca;
AxL.TickLength = [0.15 0.2];
AxR.YColor = 'g';
For more optionsdd, see: Modify Properties of Charts with Two y-Axes, in addition to Axes Properties, that I already linked to.  
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Graphics Object Properties についてさらに検索
			
	製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

