Skip to content

Commit

Permalink
Improve slightly interface of plotting so it's easier to use it
Browse files Browse the repository at this point in the history
Change-Id: Ia70ab45a8beb81512a9f83e316ad2d2bc385ef19
  • Loading branch information
ptrkrysik committed Apr 1, 2019
1 parent c5bb436 commit aaac615
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions include/grgsm/plotting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@

boost::shared_ptr<Gnuplot> current_figure;

void imagesc(arma::mat & x){
void imagesc(const arma::mat & x){
Gnuplot gp;
gp << "set palette rgb 3,2,2;";
gp << "plot ";
gp << gp.file1d(x) << "matrix with image";
gp << std::endl;
}

void plot(arma::cx_mat & x, std::string title){
void plot(const arma::cx_mat & x, std::string title){
arma::mat y = arma::abs(x);
if(current_figure.get()==NULL){
current_figure = boost::make_shared<Gnuplot>();
Expand All @@ -50,7 +50,7 @@ void plot(arma::cx_mat & x, std::string title){
(*current_figure) << std::endl;
}

void replot(arma::cx_mat & x, std::string title){
void replot(const arma::cx_mat & x, std::string title){
arma::mat y = arma::abs(x);
if(current_figure.get()==NULL){
current_figure = boost::make_shared<Gnuplot>();
Expand All @@ -61,19 +61,19 @@ void replot(arma::cx_mat & x, std::string title){
}

template<typename T>
void plot(std::vector<T> & x){
void plot(const std::vector<T> & x){
arma::cx_mat y = arma::conv_to<arma::cx_mat>::from(x);
plot(y,"");
}

template<typename T>
void plot(std::vector<T> & x, std::string title){
void plot(const std::vector<T> & x, std::string title){
arma::cx_mat y = arma::conv_to<arma::cx_mat>::from(x);
plot(y,title);
}

template<typename T>
void replot(std::vector<T> & x, std::string title){
void replot(const std::vector<T> & x, std::string title){
arma::cx_mat y = arma::conv_to<arma::cx_mat>::from(x);
replot(y,title);
}
Expand Down

0 comments on commit aaac615

Please sign in to comment.