function [] = PLOT(U,t,eq,filename,mesh_on)
%PLOT Pomocná funkce pro vykreslení řešení PDR
fig = figure;
ax = axes();
caxis(ax,[min(min(U)),max(max(U))]);
if eq.stationary
    caxis('manual');
    h = pdeplot(eq.domain.p,eq.domain.e,eq.domain.t,'XYData',U,'ColorMap','hot','Mesh','on','Contour','off','Levels',15);
    axis equal;
    if mesh_on
        h(1).EdgeAlpha = 0.1;
    end
    saveas(fig,[filename,'.png']);
else
    v = VideoWriter([filename,'.avi'],'Uncompressed AVI');
    v.FrameRate = round(size(t,2)/(eq.time(2)-eq.time(1)));
    open(v)
    caxis('manual');
    for i = 1:size(U,2)
        h = pdeplot(eq.domain.p,eq.domain.e,eq.domain.t,'XYData',round(U(:,i),3),'XYStyle','interp','ColorMap','hot','Mesh','on','Contour','off','Levels',10,'Title',sprintf('t = %.3f s',t(i)));
        axis equal;
        if mesh_on
            h(1).EdgeAlpha = 0.1; 
        end
        frame = getframe(fig);
        writeVideo(v,frame);
    end
    close(v);
end
end

