Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::plot Namespace Reference

Classes

class  Axis2DProcessorHelper
class  Axis3DProcessorHelper
struct  AxisData
class  AxisProperty
class  AxisRenderer
 Renderer for 2D axes in screen coordinates. The side to the right of the line from start to end position of the axis is defined as the "outside". As an example, consider the x axis at the bottom of a 2D plot, the outside is below the axis while the inside lies within the plot area. Mirroring the axis exchanges "outside" and "inside", that is labels and ticks will appear on the opposing side of the axis. More...
class  AxisRenderer3D
 Renderer for arbitrary axes in world coordinates. More...
class  AxisRendererBase
 Renders an axis based on AxisData. More...
class  AxisRenderProcessor
 Test processor for axis rendering. More...
class  AxisStyleProperty
 A convenience property for updating/overriding multiple axes properties. A property change will propagate to all the subproperties of the registered axes. More...
struct  BoxSelection
class  BoxSelectionInteractionHandler
 Handles interaction for 2D rectangle selection/filtering Selection/Filtering callbacks are called when filtering changes. More...
class  BoxSelectionProperty
 Settings for rectangle selection/filtering. More...
class  BoxSelectionRenderer
 Renders a 2D rectangle in screen space. Use in combination with BoxSelectionInteractionHandler. More...
class  CategoricalAxisProperty
 Axis for variables with a fixed number of possible values, e.g., categories. Will set the AxisProperty::range to match the number of categories and make it read-only. minorTicks will be made invisible. More...
class  ColorScaleLegend
class  DataFrameColumnToColorVector
class  ImagePlotProcessor
 plot an image with an x and y axis Event handling based on ViewManager More...
class  LayerAxis
struct  LinearRange
class  MajorTickProperty
class  MeshAxis
class  MinorTickProperty
class  ParallelCoordinates
class  PCPAxisSettings
class  PersistenceDiagramPlotGL
 base class for plotting a persistence diagram using OpenGL More...
class  PersistenceDiagramPlotProcessor
 plots a persistence diagram of extremum-saddle pairs with vertical lines More...
class  PlotTextProperty
class  ScatterPlotGL
class  ScatterPlotMatrixProcessor
class  ScatterPlotProcessor
struct  TextData
struct  TickData
class  VolumeAxis
 Processor for rendering axis annotations next to a volume. More...

Enumerations

enum class  AxisRangeMode : unsigned char {
  Dims , Basis , BasisOffset , World ,
  DataBoundingBox , ModelBoundingBox , WorldBoundingBox
}
enum class  CaptionType : std::uint8_t { String , Data , Custom }
enum class  DimsRangeMode : std::uint8_t { No , Yes }
enum class  LabelingAlgorithm : unsigned char {
  Heckbert , Matplotlib , ExtendedWilkinson , Limits ,
  LimitsAndZero
}
enum class  LabelScale : std::uint8_t { None , Tens , Thousands }
enum class  OffsetScaling : std::uint8_t {
  None , MinExtent , MaxExtent , MeanExtent ,
  Diagonal
}

Functions

IVW_MODULE_PLOTTINGGL_API std::array< dvec2, 3 > calcAxisRanges (const SpatialEntity &entity, std::optional< mat4 > worldBoundingBox, AxisRangeMode mode)
IVW_MODULE_PLOTTINGGL_API float calcScaleFactor2D (const glm::mat4 &matrix, OffsetScaling mode)
IVW_MODULE_PLOTTINGGL_API float calcScaleFactor3D (const glm::mat4 &matrix, OffsetScaling mode)
IVW_MODULE_PLOTTING_API OptionPropertyState< CaptionType > captionTypeState ()
IVW_MODULE_PLOTTING_API std::string formatAxisCaption (const Axis &axis, CaptionType captionType, LabelScale labelScale, std::string_view customFormat, int exponent, std::string_view origCaption)
IVW_MODULE_PLOTTING_API std::unique_ptr< MeshgenerateAxisMesh3D (const vec3 &startPos, const vec3 &endPos, const size_t &pickingId=std::numeric_limits< size_t >::max())
IVW_MODULE_PLOTTING_API std::unique_ptr< MeshgenerateTicksMesh (const std::vector< double > &tickMarks, dvec2 axisRange, TickData::Style style)
 utility function to create a mesh for a given set of tick mark positions
IVW_MODULE_PLOTTING_API vec2 getAxisCaptionPosition (const AxisData &data, const vec2 &startPos, const vec2 &endPos)
IVW_MODULE_PLOTTING_API vec3 getAxisCaptionPosition3D (const AxisData &data, const vec3 &startPos, const vec3 &endPos, const vec3 &tickDirection)
IVW_MODULE_PLOTTING_API void getLabelPositions2D (const std::vector< double > &ticks, bool mirrored, vec2 offset, dvec2 range, const vec2 &startPos, const vec2 &endPos, std::vector< ivec2 > &dest)
IVW_MODULE_PLOTTING_API void getLabelPositions3D (const std::vector< double > &positions, bool mirrored, vec2 offset, dvec2 range, const vec3 &startPos, const vec3 &endPos, const vec3 &tickDirection, std::vector< vec3 > &dest)
IVW_MODULE_PLOTTINGGL_API dmat4 getTransform (const SpatialEntity &entity, std::optional< mat4 > worldBoundingBox, AxisRangeMode mode)
IVW_MODULE_PLOTTING_API LinearRange labelingExtendedWilkinson (double valueMin, double valueMax, int numTicks, std::span< const double > steps=stepsTalbot)
IVW_MODULE_PLOTTING_API LinearRange labelingHeckbert (double valueMin, double valueMax, int numTicks)
IVW_MODULE_PLOTTING_API void labelingLimits (double valueMin, double valueMax, std::vector< double > &positions, bool includeZero=true)
IVW_MODULE_PLOTTING_API LinearRange labelingMatplotlib (double valueMin, double valueMax, int maxTicks, std::span< const double > steps=stepsMatplotlib, bool integerTicks=false, int minNTicks=2)
IVW_MODULE_PLOTTING_API OptionPropertyState< LabelScale > labelScaleState ()
constexpr std::optional< int > labelScaleStep (LabelScale scale)
IVW_MODULE_PLOTTING_API void linearRange (const dvec2 &range, const LinearRange &optRange, int minorTickFrequency, std::vector< double > &major, std::vector< double > &minor)
IVW_MODULE_PLOTTING_API void linearRange (const LinearRange &range, std::vector< double > &positions)
IVW_MODULE_PLOTTINGGL_API OptionPropertyState< AxisRangeMode > rangeModeState (bool hasDims, bool hasBoundingBox)
constexpr std::pair< dvec2, int > scaleRange (const dvec2 &r, const std::optional< int > &autoScale)
constexpr auto scaleUnit (LabelScale labelScale, Unit unit, int exp)
IVW_MODULE_PLOTTING_API std::pair< vec2, vec2 > tickBoundingRect (const AxisData &data, const std::vector< double > &majorPositions, const std::vector< double > &minorPositions, const vec2 &startPos, const vec2 &endPos)
IVW_MODULE_PLOTTING_API void updateLabelPositions (std::vector< double > &majorPositions, std::vector< double > &minorPositions, LabelingAlgorithm algorithm, const dvec2 &range, int maxTicks, int minorTickFrequency, bool fillAxis)
IVW_MODULE_PLOTTING_API void updateLabels (std::vector< std::string > &labels, const std::vector< double > &positions, std::string_view format)
IVW_MODULE_PLOTTING_API void updateLabels (std::vector< std::string > &labels, std::span< const std::string > srcLabels)

Variables

constexpr std::string_view defaultFormat = "{:.1f}"
constexpr LabelingAlgorithm defaultLabeling = LabelingAlgorithm::Matplotlib
constexpr std::array stepsMatplotlib = {1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0}
constexpr std::array stepsTalbot = {1.0, 5.0, 2.0, 2.5, 4.0, 3.0}

Detailed Description

plot

Function Documentation

◆ generateAxisMesh3D()

IVW_MODULE_PLOTTING_API std::unique_ptr< Mesh > inviwo::plot::generateAxisMesh3D ( const vec3 & startPos,
const vec3 & endPos,
const size_t & pickingId = std::numeric_limits< size_t >::max() )

No picking buffer will be generated if pickingId = std::numeric_limits<size_t>::max()

◆ generateTicksMesh()

IVW_MODULE_PLOTTING_API std::unique_ptr< Mesh > inviwo::plot::generateTicksMesh ( const std::vector< double > & tickMarks,
dvec2 axisRange,
TickData::Style style )

utility function to create a mesh for a given set of tick mark positions

Parameters
tickMarkspositions of tick marks in same coordinate system as the axis range
axisRangemin/max values of the axis
styletick style (none, inside, outside, both)
Returns
mesh containing of ticks, each tick is represented by two positions and matching colors

◆ labelingExtendedWilkinson()

IVW_MODULE_PLOTTING_API LinearRange inviwo::plot::labelingExtendedWilkinson ( double valueMin,
double valueMax,
int numTicks,
std::span< const double > steps = stepsTalbot )

Extended Wilkinson algorithm by Justin Talbot

This is an enhanced version of Wilkinson's optimization-based axis labeling approach as described by Talbot et al.

Talbot, J., Lin, S., Hanrahan, P. (2010) An Extension of Wilkinson's Algorithm for Positioning Tick Labels on Axes, InfoVis 2010.

Implementation based on https://github.com/cran/labeling/blob/master/R/labeling.R

Parameters
valueMinlower bound of the input range
valueMaxupper bound of the input range
numTicksoptimal number of ticks
stepsset of "nice" numbers, e.g. [1, 5, 2, 2.5, 4, 3]
Returns
computed labels and ticks positions

◆ labelingHeckbert()

IVW_MODULE_PLOTTING_API LinearRange inviwo::plot::labelingHeckbert ( double valueMin,
double valueMax,
int numTicks )

Heckbert's labeling algorithm

The algorithm was modified so that the ticks and labels are always within [valueMin, valueMax]

Heckbert, P. S. (1990) Nice numbers for graph labels, Graphics Gems I, Academic Press Professional, Inc.

Parameters
valueMinlower bound of the input range
valueMaxupper bound of the input range
numTicksoptimal number of ticks
Returns
computed labels and ticks positions

◆ labelingLimits()

IVW_MODULE_PLOTTING_API void inviwo::plot::labelingLimits ( double valueMin,
double valueMax,
std::vector< double > & positions,
bool includeZero = true )

Basic axis labeling showing only the limits and an optional zero.

Parameters
valueMinlower bound of the input range
valueMaxupper bound of the input range
includeZeroa label for 0.0 is included if true
Returns
computed labels and ticks positions

◆ labelingMatplotlib()

IVW_MODULE_PLOTTING_API LinearRange inviwo::plot::labelingMatplotlib ( double valueMin,
double valueMax,
int maxTicks,
std::span< const double > steps = stepsMatplotlib,
bool integerTicks = false,
int minNTicks = 2 )

matplotlib labeling algorithm

Place evenly spaced ticks, with a cap on the total number of ticks.

Finds nice tick locations with no more than maxTicks ticks being within the view limits. Locations beyond the limits are added to support autoscaling.

Implementation based on https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/ticker.py

Parameters
valueMinlower bound of the input range
valueMaxupper bound of the input range
maxTicksmaximum number of ticks
stepsset of "nice" numbers, e.g. [1, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10]
integerTicksif true, ticks will only take integer values, as long as at least minNTicks integers are found within the range
minNTicksrelax maxTicks and integerTicks constraints if necessary
Returns
computed labels and ticks positions

◆ linearRange()

IVW_MODULE_PLOTTING_API void inviwo::plot::linearRange ( const LinearRange & range,
std::vector< double > & positions )

Returns an inclusive linear range starting at start and ending at stop.

Parameters
startstarting value of the range
stoplast value of the range
stepincrement between each element of the range
Returns
linear range [start, start + step, ..., stop]
Note
it the range is invalid (start > stop and step > 0) or similar, the result is empty