Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Incorrect plot when arguments are blocks of an Eigen::Matrix #2

Closed
@Lavinius

Description

@Lavinius

If I declare an

Eigen::Matrix _2D_data; /* The initialization does not matter. The first row holds the x-coordinates, and the second row holds the y-
coordinates. */

and I want to call

plt::plot(_2D_data.row(1), _2D_data.row(2));

the resulting plot will not be correct. Around 50% of the points will have their coordinates reversed (the x-coordinates will become y-coordinates and vice-versa).

To correctly plot, I have to write:

Eigen::VectorX x_coords{ _2D_data.row(0) };
Eigen::VectorX y_coords{ _2D_data.row(1) };

plt::plot(x_coords, y_coords);

Thanks for the otherwise great library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions