function plotsave(data, filename, xlab, ylab, gr)
    hFig = figure(1);
    clf(hFig);
    set(gcf,'PaperPositionMode','auto');
    set(hFig, 'Position', [0 0 2000 400]);
    hAxes = axes( 'Position', [0.03 0.1 0.93 0.8] );
    linestyle = {'b-', 'm--', 'r:', 'g-.'};
    
    values = data.signals.values(:, gr);
    datasize = size(values);
    hold on
    for i = 1:datasize(2)
        plot( hAxes, data.time, values(:,i), linestyle{i}, 'LineWidth', 2 );
    end
    hold off
    grid on
    hX = xlabel(xlab);
    hY = ylabel(ylab, 'rot', 0);
    set( hX, 'Units', 'Normalized', 'Position', [1.025, 0.02] );
    set( hY, 'Units', 'Normalized', 'Position', [0, 1.05] );
    saveas( gcf, filename, 'png' );
    close(gcf)
end