Skip to content

plotpp::Line

Represents a line plot from x- and y-coordiantes. More...

#include <Line.hpp>

Inherits from plotpp::IPlot

Public Functions

Name
Line(optional_ptr< Tx > x, optional_ptr< Ty > y)
Constructs a Line with optional x and y coordinate ranges.
Line(Line const & ) =default
Default copy constructor.
Line(Line && ) =default
Default move constructor.
Line & operator=(Line const & ) =default
Default copy assignment.
Line & operator=(Line && ) =default
Default move assignment.
LineType lineType() const
Gets the line type.
Line & lineType(LineType lt)
Sets the line type.
Line && lineType(LineType lt)
Sets the line type.
float lineWidth() const
Gets the line width.
Line & lineWidth(float lw)
Sets the line width.
Line && lineWidth(float lw)
Sets the line width.
Color lineColor() const
Gets the line color.
Line & lineColor(Color col)
Sets the line color.
Line && lineColor(Color col)
Sets the line color.
Line & lineColor(float r, float g, float b)
Sets the line color.
Line && lineColor(float r, float g, float b)
Sets the line color.
Color fillColor() const
Gets the line color.
Line & fillColor(Color col)
Sets the fill color.
Line && fillColor(Color col)
Sets the fill color.
Line & color(Color col)
Sets the line and fill color.
Line && color(Color col)
Sets the line and fill color.
Line & autoLineColor()
Enables automatic line coloring.
Line && autoLineColor()
Enables automatic line coloring.
Line & autoFillColor()
Enables automatic fill coloring.
Line && autoFillColor()
Enables automatic fill coloring.
Line & autoColor()
Enables automatic line and fill coloring.
Line && autoColor()
Enables automatic line and fill coloring.
Line & fill(float opacity =0.3)
Sets the opacity of the fill color.
Line && fill(float opacity =0.3)
Sets the opacity of the fill color.
Line & fillPattern(int n)
Sets the fill pattern.
Line && fillPattern(int n)
Sets the fill pattern.
Line & noFill()
Disables the curve fill.
Line && noFill()
Disables the curve fill.
bool isFilled() const
Tells whether or not the fill is enabled.
Line & label(const PlotTitle & label)
Sets the label to be seen in the legend of the plot.
Line && label(const PlotTitle & label)
Sets the label to be seen in the legend of the plot.
Line & label(PlotTitle && label)
Sets the label to be seen in the legend of the plot.
Line && label(PlotTitle && label)
Sets the label to be seen in the legend of the plot.
Tx * x()
Gets the x-values.
const Tx * x() const
Gets the x-values.
Ty * y()
Gets the y-values.
const Ty * y() const
Gets the y-values.
virtual void printPlot(FILE * fptr) const override
prints the plot command for gnuplot
virtual void printData(FILE * fptr) const override
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 Tx,
std::ranges::forward_range Ty>
class plotpp::Line;

Represents a line plot from x- and y-coordiantes.

Template Parameters:

The Line class holds information about how to draw a line plot in a figure. It supports various customizations such as line type, color, and fill styles.

Public Functions Documentation

function Line

inline Line(
    optional_ptr< Tx > x,
    optional_ptr< Ty > y
)

Constructs a Line with optional x and y coordinate ranges.

Parameters:

Suggestion: Use these construction helpers instead:

function Line

Line(
    Line const & 
) =default

Default copy constructor.

function Line

Line(
    Line && 
) =default

Default move constructor.

function operator=

Line & operator=(
    Line const & 
) =default

Default copy assignment.

function operator=

Line & operator=(
    Line && 
) =default

Default move assignment.

function lineType

inline LineType lineType() const

Gets the line type.

Return: LineType - The current LineType

function lineType

inline Line & lineType(
    LineType lt
)

Sets the line type.

Parameters:

  • lt : LineType - The new line type

Return: Line - Self, for method chaining

function lineType

inline Line && lineType(
    LineType lt
)

Sets the line type.

Parameters:

  • lt : float - The new line type

Return: Line - Self, for method chaining

function lineWidth

inline float lineWidth() const

Gets the line width.

Return: float: The current line width

function lineWidth

inline Line & lineWidth(
    float lw
)

Sets the line width.

Parameters:

  • lw : float - The new line width

Return: Line - Self, for method chaining

function lineWidth

inline Line && lineWidth(
    float lw
)

Sets the line width.

Parameters:

  • lw : float - The new line width

Return: Line - Self, for method chaining

function lineColor

inline Color lineColor() const

Gets the line color.

Return: Color - the current line color

function lineColor

inline Line & lineColor(
    Color col
)

Sets the line color.

Parameters:

  • col : Color - The new line color

Return: Line - Self, for method chaining

function lineColor

inline Line && lineColor(
    Color col
)

Sets the line color.

Parameters:

  • col : Color - The new line color

Return: Line - Self, for method chaining

function lineColor

inline Line & lineColor(
    float r,
    float g,
    float b
)

Sets the line color.

Parameters:

  • rgb : float - The new line color in rgb-values in the range [0, 1]

Return: Line - Self, for method chaining

function lineColor

inline Line && lineColor(
    float r,
    float g,
    float b
)

Sets the line color.

Parameters:

  • rgb : float - The new line color in rgb-values in the range [0, 1]

Return: Line - Self, for method chaining

function fillColor

inline Color fillColor() const

Gets the line color.

Return: Color - the current fill color

function fillColor

inline Line & fillColor(
    Color col
)

Sets the fill color.

Parameters:

  • col : Color - The new fill color

Return: fill - Self, for method chaining

function fillColor

inline Line && fillColor(
    Color col
)

Sets the fill color.

Parameters:

  • col : Color - The new fill color

Return: fill - Self, for method chaining

function color

inline Line & color(
    Color col
)

Sets the line and fill color.

Parameters:

  • col : Color - The new line and fill color

Return: fill - Self, for method chaining

function color

inline Line && color(
    Color col
)

Sets the line and fill color.

Parameters:

  • col : Color - The new line and fill color

Return: fill - Self, for method chaining

function autoLineColor

inline Line & autoLineColor()

Enables automatic line coloring.

Return: Line - Self, for method chaining

function autoLineColor

inline Line && autoLineColor()

Enables automatic line coloring.

Return: Line - Self, for method chaining

function autoFillColor

inline Line & autoFillColor()

Enables automatic fill coloring.

Return: Line - Self, for method chaining

function autoFillColor

inline Line && autoFillColor()

Enables automatic fill coloring.

Return: Line - Self, for method chaining

function autoColor

inline Line & autoColor()

Enables automatic line and fill coloring.

Return: Line - Self, for method chaining

function autoColor

inline Line && autoColor()

Enables automatic line and fill coloring.

Return: Line - Self, for method chaining

function fill

inline Line & fill(
    float opacity =0.3
)

Sets the opacity of the fill color.

Parameters:

  • rgb : float - the new opacity in a range of [0, 1]

Return: Line - Self, for method chaining

function fill

inline Line && fill(
    float opacity =0.3
)

Sets the opacity of the fill color.

Parameters:

  • rgb : float - the new opacity in a range of [0, 1]

Return: Line - Self, for method chaining

function fillPattern

inline Line & fillPattern(
    int n
)

Sets the fill pattern.

Parameters:

  • n : int - Select one of Gnuplots fill patterns. May be benefitial for printing figures on paper.

Return: Line - Self, for method chaining

function fillPattern

inline Line && fillPattern(
    int n
)

Sets the fill pattern.

Parameters:

  • n : int - Select one of Gnuplots fill patterns. May be benefitial for printing figures on paper.

Return: Line - Self, for method chaining

function noFill

inline Line & noFill()

Disables the curve fill.

Return: Line - Self, for method chaining

function noFill

inline Line && noFill()

Disables the curve fill.

Return: Line - Self, for method chaining

function isFilled

inline bool isFilled() const

Tells whether or not the fill is enabled.

Return: bool - Returns true if the fill is enabled and false otherwise

function label

inline Line & label(
    const PlotTitle & label
)

Sets the label to be seen in the legend of the plot.

Parameters:

  • label : PlotTitle - A title of the plot containing the label to be displayed in the legend

Return: Line - Self, for method chaining

function label

inline Line && label(
    const PlotTitle & label
)

Sets the label to be seen in the legend of the plot.

Parameters:

  • label : PlotTitle - A title of the plot containing the label to be displayed in the legend

Return: Line - Self, for method chaining

function label

inline Line & label(
    PlotTitle && label
)

Sets the label to be seen in the legend of the plot.

Parameters:

  • label : PlotTitle - A title of the plot containing the label to be displayed in the legend

Return: Line - Self, for method chaining

function label

inline Line && label(
    PlotTitle && label
)

Sets the label to be seen in the legend of the plot.

Parameters:

  • label : PlotTitle - A title of the plot containing the label to be displayed in the legend

Return: Line - Self, for method chaining

function x

inline Tx * x()

Gets the x-values.

Return: Tx - A pointer to the provided x-values of the plot. May be a nullptr if non were provided.

function x

inline const Tx * x() const

Gets the x-values.

Return: Tx - A pointer to the provided x-values of the plot. May be a nullptr if non were provided.

function y

inline Ty * y()

Gets the y-values.

Return: Ty - A pointer to the provided y-values of the plot

function y

inline const Ty * y() const

Gets the y-values.

Return: Ty - A pointer to the provided y-values of the plot

function printPlot

inline virtual void printPlot(
    FILE * fptr
) const override

prints the plot command for gnuplot

Parameters:

  • file : FILE - A pointer to the stream/file that the plot command shall be written to.

Reimplements: plotpp::IPlot::printPlot

This function does normally not need to be called by the user. The class Figure will take care it and the communication with Gnuplot.

function printData

inline virtual void printData(
    FILE * fptr
) const override

prints the data for gnuplot

Parameters:

  • file : FILE - A pointer to the stream/file that the plot command shall be written to.

Reimplements: plotpp::IPlot::printData

This function does normally not need to be called by the user. The class Figure will take care it and the communication with Gnuplot.


Updated on 2025-03-02 at 14:13:17 +0100