command for which the label on the x axis is not shown
3 次查看(过去 30 天)
显示 更早的评论
Hi,
I am looking for a command so that there are no values on the x axis shown.
I tried this;
set(gca,'xtick',[])
but it's not working, any idea
采纳的回答
per isakson
2013-5-18
It works here (R2012a)
sdn = [ 1 : 6 ] + 735370;
date_strings = datestr( sdn, 'dd-mmm-yyyy' );
plot( [1:6] )
axh = gca;
set( axh, 'XTickLabel', date_strings )
set( axh, 'XTick', [] )
There are neither ticks nor labels on the x-axis.
1 个评论
per isakson
2013-5-18
This example is according to the documentation and it works here.
What could the reason be that it doesn't work for you?
- you have more than one axes object and the current axes is an "other" axes; not the one you think
Restart Matlab and run this example. I would very surprised it it behaves differently compare to what I see.
更多回答(2 个)
Image Analyst
2013-5-18
Like I said in your duplicate question:
plot(1:10); % Plot some arbitrary sample data.
set(gca, 'xtick', [-inf inf]); % Turn off x-axis.
3 个评论
Image Analyst
2013-5-18
Explain why it does not work. It plots something in an axes control "where there are no value displayed on the x axis" just like you asked for.
Give me something we can run:
Undefined variable dataSet.
Error in test3 (line 1)
dates=datenum(dataSet(:,1));
Walter Roberson
2013-5-18
What you are missing is that you used plotyy() without mentioning it to us. plotyy() generates two axes, and makes no promises about what gca() will refer to afterwards. You need to save the output of the plotyy() call and use the appropriate axes from what is returned.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Two y-axis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!