Changing tick labels on x axis
Show older comments
Hi there,
I'm trying to change the labels on my plot's x-axis, but without any success. I've already read on here through the issues others have had and tried them but it seems I'm doing something wrong.
- When I set my cfg.xlim = ([-0.1 1.5]), it does limit the axis to these but I only get ticks at -0.1, 0.5, 1 and 1.5, which in my case isn't very helpful as I'm looking into milliseconds differences.
- When I try something like cfg.limits = ([-0.1:0.2:1.5]), it cuts my axis at 0.9.
- When I try setting cfg.xticks = ([-0.1:0.2:1.5]), it simply does nothing.
- I tried the below code as well, creating a double of the ticks I'd want.
Could anyone point me to where the problem is please?
Note, the data is EEG data and I'm using singleplotER, which is from the Fieldtrip toolbox. Nevermind, the axis changes should still work, reportedly...
cfg = [];
cfg.showlabels = 'yes';
cfg.fontsize = 15;
cfg.linewidth = 1.5
cfg.layout = 'EEG1010.lay';
cfg.channel = 'CPz';
cfg.ylim = ([-6.5 6.5])
axisticks = ([-0.1:0.2:1.5])
cfg.xmin = ([min(axisticks)])
cfg.xmax = ([max(axisticks)])
cfg.xticks = ([axisticks])
ft_singleplotER(cfg, ER_S_av_RT, ER_NS_av_RT);
axes = gca;
line([0 0],[-6.5 6.5],'Color','Black')
line([0.553 0.553],[-6.5 6.5],'Color','Black')
line([1.149 1.149],[-6.5 6.5],'Color','Black')
line([-1 21],[0 0],'Color','Black')
set(gca,'box','on');
ylabel('Electric Potential (\muV)')
xlabel('Time (s)')
cfg.showlegend = 'yes'
legend({'Condition 1', 'Condition 2'},'Location','southeast','FontSize',12);
title('Difference between conditions')
Accepted Answer
More Answers (1)
Image Analyst
on 5 Jun 2022
1 vote
Categories
Find more on Grid Lines, Tick Values, and Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!