Showing posts with label carpetplot. Show all posts
Showing posts with label carpetplot. Show all posts

Tuesday, July 22, 2008

about renderers and exporting figures

Today i was having trouble exporting a figure using the opengl renderer (default for surfaces). To see which renderer a figure is using, use this command:

get(gcf,'Renderer')

The solution was to change the renderer to z-buffer. To do so, just use this command:
set(gcf,'Renderer','zbuffer')

This was necessary to export my carpetplots using the command:

myStyle = hgexport('factorystyle');
myStyle.Format = 'png';
myStyle.Width = 6;
myStyle.Height = 4;
myStyle.Resolution = 300;
myStyle.Units = 'inch';
myStyle.FixedFontSize = 12;
hgexport(h.fig,'filename.png',myStyle,'Format','png')

See my other posts to know more about the carpetplot function.

Thursday, November 22, 2007

carpetplot with matlab - part 2

hi, i have made some modifications to the carpetplot function.

here they are




function carpetplot(data,FigNr)

max_zeilen = 24;
zeile=1;
spalte=1;
i=1;
while spalte <= 365, while zeile <= max_zeilen, DATA(zeile,spalte)=data(i); zeile=zeile+1; i=i+1; end spalte=spalte+1; zeile=1; end %DATA=flipud(DATA); x=[1:1:365]; y=[0:1:23]; %% figure(FigNr) clf axes1 = axes(... 'FontSize',12,... 'LineWidth',1,... 'Box','on',... 'Parent',figure(FigNr),... 'YDir','reverse',... 'YTick',[0 4 8 12 16 20 ],... 'PlotBoxAspectRatio',[1 1 1]); xlabel(axes1,'Tage im Jahr'); ylabel(axes1,'Uhrzeit'); grid(axes1,'off'); hold(axes1,'all'); set(gca,'XLim',([1 365]),'YLim',([0 23]))%,'ZLim',([-20000 -5000])) surf(x,y,DATA,'EdgeColor','none',... 'LineWidth',1,'Parent',axes1); view(0,90) colorbar('Fontsize',12) annotation(gcf,'textarrow',[0.9 0.9],[0.7723 0.8215],... 'TextEdgeColor','none',... 'TextRotation',90,... 'FontSize',12,... 'String','Tempeartur in °C',... 'HeadStyle','none',... 'LineStyle','none');

Friday, November 9, 2007

carpet plots with matlab



if you are planning to plot some data as carpet plot, you can use matlab. there is a simple trick to do that.

in this example, i create a carpet plot for a 35040 vector.
first, i convert the data into a 365x96 matrix. then i plot it using the surf command, and change the view point with "view(0,90)"
that's all!
here the function:



function carpetplot(data,FigNr,colormap)



max_zeilen = 24*4;
zeile=1;
spalte=1;
i=1;
while spalte <= 365,
while zeile <= max_zeilen,
DATA(zeile,spalte)=data(i);
zeile=zeile+1;
i=i+1;
end
spalte=spalte+1;
zeile=1;
end


x=[1:1:365];
y=[0:(1/(4)):24-1/(4)];
figure(FigNr)
clf
axes1 = axes(...
'FontSize',16,...
'LineWidth',1,...
'Box','on',...
'Parent',figure(FigNr));%,...
% 'CLim',[-20000 -5000]);
xlabel(axes1,'Tag im Jahr');
ylabel(axes1,'Uhrzeit');
grid(axes1,'off');
hold(axes1,'all');




set(gca,'XLim',([1 365]),'YLim',([0 (24-1/(4*60))]))%,'ZLim',([-20000 -5000]))

surf(x,y,DATA,'EdgeColor','none',...
'LineWidth',1,'Parent',axes1);
view(0,90)



colorbar1 = colorbar('peer',...
axes1,'EastOutside',...
'Box','on',...
'FontSize',16,...
'XLim',[-0.5 1.5], 'YLim', [-20000 -5000],...
'CLim',[0 6]);


%load('MyColormaps','mycmap')
set(figure(FigNr),'Colormap',colormap)

% set(axes1,'CLim', [0 4])
take a look to the part 2 of the carpet plot function