Remove common factor from axis

4 ビュー (過去 30 日間)
Pierce Brady
Pierce Brady 2011 年 8 月 2 日
Hey, I'm trying to remove the common factor from the axis of a plot.
This is what i'm doing. (its a custom color bar)
cX = [1 2];
cY = repmat(linspace(1,8e6,256),2,1).';
h.figure = figure;
h.panel = uipanel('Parent',h.figure);
h.axes = axes('Parent',h.panel);
h.surf = surf('Parent',h.axes,'XData',cX ,'YData',cY,'ZData',cY,'CData',cY);
set(h.surf,'Facecolor','interp','Edgecolor','none')
set(h.axes,'View',[90 90]...
,'XTick',[],'XTickLabel',[]...
,'ZTick',[],'ZTickLabel',[]...
,'YTick',(1:8)*1e6,'YTickLabel',{'1M','2M','3M','4M','5M','6M','7M','8M'}...
,'YLim',[min(cY(:)) max(cY(:))])
Now the final plot has
1M 2M ... 8M 1x10^6
along the axis
I would like the axis to just be
1M 2M ... 8M
without the common factor of 1x10^6
Can anyone help me achieve this.
  1 件のコメント
Jan
Jan 2011 年 8 月 2 日
Please use code formatting. See the "{} Code" button and the "? Markup" link.

サインインしてコメントする。

回答 (2 件)

Kelly Kearney
Kelly Kearney 2011 年 8 月 2 日
Change the renderer from OpenGL to zbuffer.
set(gcf, 'renderer', 'zbuffer');
Why this fixes the problem, I really have no idea. But I encounter it a lot when I add dateticks to my axes. Not sure if it's intended behavior or a bug, but most renderers eliminate the factor when manual tick labels are added; OpenGL does not (or at least doesn't always).

Pierce Brady
Pierce Brady 2011 年 8 月 2 日
Problem half sorted.
cX = [1 2];
cY = repmat(linspace(1,8,256),2,1).';
cZ = repmat(linspace(1,8e6,256),2,1).';
h.figure = figure;
h.panel = uipanel('Parent',h.figure);
h.axes = axes('Parent',h.panel);
h.surf = surf('Parent',h.axes,'XData',cX,'YData',cY,'ZData',cZ,'CData',cZ);
set(h.surf,'Facecolor','interp','Edgecolor','none')
set(h.axes,'View',[90 90]... ,'XTick',[],'XTickLabel',[]...
,'ZTick',[],'ZTickLabel',[]...
,'YTick',(1:8),'YTickLabel',... {'1M','2M','3M','4M','5M','6M','7M','8M'}...
,'YLim',[min(cY(:)) max(cY(:))])
Doing this i avoid the common factor, but i'd still like to know how to remove the 1x10^6 without changing the magnitude of the data

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by