Problem with a plot
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all,
I'm working on a simulation for some misurement with a Thomson spectrometer and I'm having some issue with the plot layout. In x and y axis I have magnetic and electric deflection and I have other two axis on top and right giving momentum and energy info. I am not able to write the secondary tick label in the proper way: as defoult MatLab writes tick label as integer and a (x10^-12) at the end of the label but on the bottom of the screen. If I use: [code] set(gca, 'YTickLabel', num2str(get(gca,'YTick')','%d')) [\code]
it writes the tick label as "6.00000e^12" and I have some overlaps.
Moreover if I make the plot window bigger the secondary axes don't resize properly. Last the plot title is written too high...
Could somebody help me in fixing this bugs? Thanks
I can provide the code I wrote for the plot, if need
댓글 수: 1
the cyclist
2012년 1월 23일
It would definitely be helpful for you to provide the code, ideally in a way that is distilled into the bare minimum that exhibits the problem.
채택된 답변
Walter Roberson
2012년 1월 23일
MATLAB does not default to writing the tick labels as integers, unless perhaps that is the default when you supply your own tick label in numeric form instead of string. If no tick labels are supplied, MATLAB dynamically formats tick labels.
What format do you want your tick label to come out as? Perhaps
set(gca, 'YTickLabel', num2str(get(gca,'YTick')','%g'))
댓글 수: 2
추가 답변 (3개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Axis Labels에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!