plotpp::Arrows
class for plotting arrows/vectors/quivers in plotpp::Figure More...
#include <Arrows.hpp>
Inherits from plotpp::IPlot
Public Functions
Name | |
---|---|
Arrows(optional_ptr< const Tx1 > x1, optional_ptr< const Ty1 > y1, optional_ptr< const Tx2 > x2, optional_ptr< const Ty2 > y2) Constructs an Arrow from x and y data for plotting plotpp::Figure. |
|
Arrows & | label(const char * label) adds a label to the plot which can be seen in legends |
Arrows && | label(const char * label) |
Arrows & | label(std::string_view label) |
Arrows && | label(std::string_view label) |
Arrows & | label(std::string && label) |
Arrows && | label(std::string && label) |
float | lineWidth() const |
Arrows & | lineWidth(float lw) Changes the width of the line. |
Arrows && | lineWidth(float lw) |
DataRelation | dataRelation() const Returns the relation of [x2, y2]. |
Arrows & | dataRelation(DataRelation dr) Changes the relation of the start and end data points. |
Arrows && | dataRelation(DataRelation dr) |
ArrowHeadStyle | arrowHeadStyle() const |
Arrows & | arrowHeadStyle(ArrowHeadStyle ahs) |
Arrows && | arrowHeadStyle(ArrowHeadStyle ahs) |
Color | color() const |
Arrows & | color(Color col) Sets the color of the line. |
Arrows && | color(Color col) |
virtual void | printPlot(FILE * fptr) const Prints the plot command for gnuplot. |
virtual void | printData(FILE * fptr) const Prints the data for gnuplot. |
Additional inherited members
Public Functions inherited from plotpp::IPlot
Name | |
---|---|
IPlot() =default | |
IPlot(std::string label) | |
virtual | ~IPlot() |
virtual void | printSettings(std::ostream & stream) const =delete |
virtual void | printSettings(FILE * fptr) const |
Protected Functions inherited from plotpp::IPlot
Name | |
---|---|
virtual IPlot & | uid(size_t & uid_io) |
size_t | uid() const |
Friends inherited from plotpp::IPlot
Name | |
---|---|
class | Figure |
Detailed Description
template <std::ranges::forward_range Tx1,
std::ranges::forward_range Ty1,
std::ranges::forward_range Tx2,
std::ranges::forward_range Ty2>
class plotpp::Arrows;
class for plotting arrows/vectors/quivers in plotpp::Figure
Template Parameters:
- Tx1Ty1Tx2Ty2 Generic types that store the data for plotting and are forward ranges (aka. have
begin()
andend()
iterators)
Arrows contains the start and end coordinates for vectors. The relationship between the datasets ([x1, y1] and [x2, y2]) can be set using plotpp::DataRelation. In every case [x1, y1] will be the absolute start coordinate of the vector and [x2, y2] can the absolute end coordinate or relative to the start.
To construct arrows/vectors/quivers See
- arrows(U1&& x1, U2&& y1, U3&& x2, U4&& y2), absolute coordinates
- vector(U1&& x1, U2&& y1, U3&& x2, U4&& y2), alias for arrows()
- quiver(U1&& x1, U2&& y1, U3&& x2, U4&& y2), relative coordinates
Public Functions Documentation
function Arrows
inline Arrows(
optional_ptr< const Tx1 > x1,
optional_ptr< const Ty1 > y1,
optional_ptr< const Tx2 > x2,
optional_ptr< const Ty2 > y2
)
Constructs an Arrow from x and y data for plotting plotpp::Figure.
Parameters:
- x1y1 the start coordinates of the vector
- x2y2 the end coordinates of the vector. Can be absolute or relative.
For easier construction use the following functions instead. They will automatically create the correct optional_ptr type.
- arrows(U1&& x1, U2&& y1, U3&& x2, U4&& y2), absolute coordinates
- vector(U1&& x1, U2&& y1, U3&& x2, U4&& y2), alias for arrows()
- quiver(U1&& x1, U2&& y1, U3&& x2, U4&& y2), relative coordinates
function label
inline Arrows & label(
const char * label
)
adds a label to the plot which can be seen in legends
Parameters:
- label a string to set the label name shown in the legend
Return: the class itself for method chaining
function label
inline Arrows && label(
const char * label
)
function label
inline Arrows & label(
std::string_view label
)
function label
inline Arrows && label(
std::string_view label
)
function label
inline Arrows & label(
std::string && label
)
function label
inline Arrows && label(
std::string && label
)
function lineWidth
inline float lineWidth() const
Return: The line width
function lineWidth
inline Arrows & lineWidth(
float lw
)
Changes the width of the line.
Parameters:
- lw The new linewidth
Return: The class itself for method chaining
function lineWidth
inline Arrows && lineWidth(
float lw
)
function dataRelation
inline DataRelation dataRelation() const
Returns the relation of [x2, y2].
Return: DataRelation
DataRelation::absolute
if the end coordinates [x2, y2] are absolute to the origin of the FigureDataRelation::relative
if the end coordinates [x2, y2] are relative to [x1, y1]
function dataRelation
inline Arrows & dataRelation(
DataRelation dr
)
Changes the relation of the start and end data points.
The relationship of the start [x1, y1] coordinates and end [x2, y2] coordinates can be set with the enum plotpp::DataRelation. If set to
DataRelation::absolute
[x2, y2] will be absolute to the origin of the plotDataRelation::relative
[x2, y2] will be relative to the start point [x1, y1]- default is
DataRelation::absolute
lwThe new linewidth
The Class itself for method chaining
function dataRelation
inline Arrows && dataRelation(
DataRelation dr
)
function arrowHeadStyle
inline ArrowHeadStyle arrowHeadStyle() const
Return: The style of the arrow head (plotpp::ArrowHeadStyle)
function arrowHeadStyle
inline Arrows & arrowHeadStyle(
ArrowHeadStyle ahs
)
function arrowHeadStyle
inline Arrows && arrowHeadStyle(
ArrowHeadStyle ahs
)
function color
inline Color color() const
Return: The color of the line (plotpp::Color)
function color
inline Arrows & color(
Color col
)
Sets the color of the line.
Return: The class itself for method chaining
function color
inline Arrows && color(
Color col
)
function printPlot
inline virtual void printPlot(
FILE * fptr
) const
Prints the plot command for gnuplot.
Parameters:
- fptr The file or stream that the plot command should be written to
Reimplements: plotpp::IPlot::printPlot
function printData
inline virtual void printData(
FILE * fptr
) const
Prints the data for gnuplot.
Parameters:
- fptr The file or stream that the data should be written to
Reimplements: plotpp::IPlot::printData
Updated on 2025-03-02 at 14:13:16 +0100