mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-29 10:24:51 +00:00
Merge branch 'savepdf' into next
Save Gnuplot figures in pdf files
This commit is contained in:
commit
967e418fcd
@ -246,6 +246,9 @@ public:
|
||||
/// saves a gnuplot session to a postscript file, filename without extension
|
||||
Gnuplot& savetops(const std::string &filename = "gnuplot_output");
|
||||
|
||||
/// saves a gnuplot session to a pdf file, filename without extension
|
||||
Gnuplot& savetopdf(const std::string &filename = "gnuplot_output", unsigned int font_size = 12);
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// set and unset
|
||||
|
||||
@ -1063,6 +1066,22 @@ Gnuplot& Gnuplot::showonscreen()
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// saves a gnuplot session to a pdf file
|
||||
//
|
||||
Gnuplot& Gnuplot::savetopdf(const std::string &filename, unsigned int font_size)
|
||||
{
|
||||
std::ostringstream cmdstr;
|
||||
cmdstr << "set term pdfcairo enhanced color font \"Times-New-Roman," + std::to_string(font_size) + "\"\n";
|
||||
cmdstr << "set output \"" << filename << ".pdf\"\n";
|
||||
cmdstr << "replot";
|
||||
cmd(cmdstr.str());
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// saves a gnuplot session to a postscript file
|
||||
|
@ -617,6 +617,7 @@ void StaticPositionSystemTest::print_results(const std::vector<double> & east,
|
||||
g1.cmd("replot");
|
||||
|
||||
g1.savetops("Position_test_2D");
|
||||
g1.savetopdf("Position_test_2D", 18);
|
||||
g1.showonscreen(); // window output
|
||||
|
||||
Gnuplot g2("points");
|
||||
@ -636,6 +637,7 @@ void StaticPositionSystemTest::print_results(const std::vector<double> & east,
|
||||
g2.plot_xyz(east, north, up, "3D Position Fixes");
|
||||
|
||||
g2.savetops("Position_test_3D");
|
||||
g2.savetopdf("Position_test_3D");
|
||||
g2.showonscreen(); // window output
|
||||
}
|
||||
catch (GnuplotException ge)
|
||||
|
@ -126,6 +126,7 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
g1.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(FLAGS_fft_iterations_test) + " iterations)");
|
||||
g1.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
|
||||
g1.savetops("FFT_execution_times_extended");
|
||||
g1.savetopdf("FFT_execution_times_extended", 18);
|
||||
g1.showonscreen(); // window output
|
||||
|
||||
Gnuplot g2("linespoints");
|
||||
@ -137,6 +138,7 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
g2.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(FLAGS_fft_iterations_test) + " iterations)");
|
||||
g2.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
|
||||
g2.savetops("FFT_execution_times");
|
||||
g2.savetopdf("FFT_execution_times", 18);
|
||||
g2.showonscreen(); // window output
|
||||
}
|
||||
catch (GnuplotException ge)
|
||||
|
Loading…
Reference in New Issue
Block a user