diff --git a/src/tests/common-files/gnuplot_i.h b/src/tests/common-files/gnuplot_i.h index ef5dbb241..614dc678e 100644 --- a/src/tests/common-files/gnuplot_i.h +++ b/src/tests/common-files/gnuplot_i.h @@ -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 diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 64401bb00..048abefea 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -617,6 +617,7 @@ void StaticPositionSystemTest::print_results(const std::vector & 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 & 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) diff --git a/src/tests/unit-tests/arithmetic/fft_length_test.cc b/src/tests/unit-tests/arithmetic/fft_length_test.cc index 3ccb2b640..f8ea83d22 100644 --- a/src/tests/unit-tests/arithmetic/fft_length_test.cc +++ b/src/tests/unit-tests/arithmetic/fft_length_test.cc @@ -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)