How to remove ticks from the secondary axis in the example below?
    20 ビュー (過去 30 日間)
  
       古いコメントを表示
    
Hello - Can you help me remove the secondary axis ticks (both in x and y secondary axis) from the code below? Figure attached shows the ticks in primary and secondary axis.
close all; clear; clc; workspace;
%%
data = readmatrix('dddcb.xls', 'sheet', 1, 'Range', 'A3:B400');
first_col1  = data(1:398, 1);       
second_col1 = data(1:398, 2);        
dose_per_decay1 = second_col1/20000000;
figure(1)
plot(first_col1, dose_per_decay1, 'Color', '[0 0 0]', 'LineWidth',2);
% Make ticks longer and thicker
ax = gca;
properties(ax)
for k = .01 : 0.01 : .02
  ax.TickLength = [k, k];     % Make tick marks longer
  ax.LineWidth = 50 * k;      % Make tick marks thicker
end
ay = gca;
properties(ay)
for k = .01 : 0.01 : .02
  ay.TickLength = [k, k];
end
grid off
ax = gca;
ax.XGrid = 'on';
ax.YGrid = 'on';
ax.GridLineStyle = '-';
hAx = gca;   % avoid repetitive function calls
set(hAx,'xminorgrid','on','yminorgrid','off') % turn off y-minor grid lines

legend({'\color[rgb]{0 0 0} 3 MeV '}, 'Fontsize', 12);
legend('boxoff')
set(gca,'TickDir','out');
set(gca, 'YScale', 'log');
set(gca, 'XScale', 'log');
set(gca,'FontSize',16, 'XMinorTick','on','YMinorTick','on');
ax = gca;
xlim([1 100]);
ylim([0.000001 100]);
xlabel('distance (\mum)', 'FontSize', 14);
ylabel('dose/decay', 'FontSize', 14);
0 件のコメント
採用された回答
  Voss
      
      
 2022 年 7 月 20 日
        loglog(1:10000)
ax = gca;
set(ax, ...
    'XGrid','on', ...
    'YGrid','on', ...
    'GridLineStyle','-', ...
    'XMinorGrid','on', ...
    'YMinorGrid','off', ...
    'XMinorTick','off', ...
    'YMinorTick','off', ...
    'FontSize',16);
5 件のコメント
  Voss
      
      
 2022 年 7 月 21 日
				I don't know of a built-in way to have lines on all four sides and ticks on only two sides of the axes, so as far as I know you'll have to do a workaround of one kind or another.
Here's one way you can create the missing black lines on top and right:
loglog(1:10000)
xl = xlim();
yl = ylim();
line('XData',xl([1 2 2]),'YData',yl([2 2 1]),'Color','k');
ax = gca;
set(ax, ...
    'Box','off', ...
    'XGrid','on', ...
    'YGrid','on', ...
    'GridLineStyle','-', ...
    'XMinorGrid','on', ...
    'YMinorGrid','off', ...
    'FontSize',16);
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Frequency Transformations についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


