Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QCPAxisTickerLog Class Reference

Specialized axis ticker suited for logarithmic axes. More...

#include <qcustomplot.h>

Inheritance diagram for QCPAxisTickerLog:
Inheritance graph
[legend]

Public Member Functions

double logBase () const
 
 QCPAxisTickerLog ()
 
void setLogBase (double base)
 
void setSubTickCount (int subTicks)
 
int subTickCount () const
 
- Public Member Functions inherited from QCPAxisTicker
virtual void generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels)
 
 QCPAxisTicker ()
 
void setTickCount (int count)
 
void setTickOrigin (double origin)
 
void setTickStepStrategy (TickStepStrategy strategy)
 
int tickCount () const
 
double tickOrigin () const
 
TickStepStrategy tickStepStrategy () const
 
virtual ~QCPAxisTicker ()
 

Protected Member Functions

virtual QVector< double > createTickVector (double tickStep, const QCPRange &range) Q_DECL_OVERRIDE
 
virtual int getSubTickCount (double tickStep) Q_DECL_OVERRIDE
 
virtual double getTickStep (const QCPRange &range) Q_DECL_OVERRIDE
 
- Protected Member Functions inherited from QCPAxisTicker
double cleanMantissa (double input) const
 
virtual QVector< QString > createLabelVector (const QVector< double > &ticks, const QLocale &locale, QChar formatChar, int precision)
 
virtual QVector< double > createSubTickVector (int subTickCount, const QVector< double > &ticks)
 
double getMantissa (double input, double *magnitude=0) const
 
virtual QString getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision)
 
double pickClosest (double target, const QVector< double > &candidates) const
 
void trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const
 

Protected Attributes

double mLogBase
 
double mLogBaseLnInv
 
int mSubTickCount
 
- Protected Attributes inherited from QCPAxisTicker
int mTickCount
 
double mTickOrigin
 
TickStepStrategy mTickStepStrategy
 

Additional Inherited Members

- Public Types inherited from QCPAxisTicker
enum  TickStepStrategy { tssReadability, tssMeetTickCount }
 

Detailed Description

Specialized axis ticker suited for logarithmic axes.

axisticker-log.png

This QCPAxisTicker subclass generates ticks with unequal tick intervals suited for logarithmic axis scales. The ticks are placed at powers of the specified log base (setLogBase).

Especially in the case of a log base equal to 10 (the default), it might be desirable to have tick labels in the form of powers of ten without mantissa display. To achieve this, set the number precision (QCPAxis::setNumberPrecision) to zero and the number format (QCPAxis::setNumberFormat) to scientific (exponential) display with beautifully typeset decimal powers, so a format string of "eb". This will result in the following axis tick labels:

axisticker-log-powers.png

The ticker can be created and assigned to an axis like this:

Definition at line 1835 of file qcustomplot.h.

Constructor & Destructor Documentation

◆ QCPAxisTickerLog()

QCPAxisTickerLog::QCPAxisTickerLog ( )

Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker.

Definition at line 7031 of file qcustomplot.cpp.

Member Function Documentation

◆ createTickVector()

QVector< double > QCPAxisTickerLog::createTickVector ( double  tickStep,
const QCPRange range 
)
protectedvirtual

Reimplemented from QCPAxisTicker.

Definition at line 7106 of file qcustomplot.cpp.

◆ getSubTickCount()

int QCPAxisTickerLog::getSubTickCount ( double  tickStep)
protectedvirtual

Reimplemented from QCPAxisTicker.

Definition at line 7091 of file qcustomplot.cpp.

◆ getTickStep()

double QCPAxisTickerLog::getTickStep ( const QCPRange range)
protectedvirtual

Reimplemented from QCPAxisTicker.

Definition at line 7077 of file qcustomplot.cpp.

◆ logBase()

double QCPAxisTickerLog::logBase ( ) const
inline

Definition at line 1841 of file qcustomplot.h.

◆ setLogBase()

void QCPAxisTickerLog::setLogBase ( double  base)

Sets the logarithm base used for tick coordinate generation. The ticks will be placed at integer powers of base.

Definition at line 7042 of file qcustomplot.cpp.

◆ setSubTickCount()

void QCPAxisTickerLog::setSubTickCount ( int  subTicks)

Sets the number of sub ticks in a tick interval. Within each interval, the sub ticks are spaced linearly to provide a better visual guide, so the sub tick density increases toward the higher tick.

Note that subTicks is the number of sub ticks (not sub intervals) in one tick interval. So in the case of logarithm base 10 an intuitive sub tick spacing would be achieved with eight sub ticks (the default). This means e.g. between the ticks 10 and 100 there will be eight ticks, namely at 20, 30, 40, 50, 60, 70, 80 and 90.

Definition at line 7062 of file qcustomplot.cpp.

◆ subTickCount()

int QCPAxisTickerLog::subTickCount ( ) const
inline

Definition at line 1842 of file qcustomplot.h.

Member Data Documentation

◆ mLogBase

double QCPAxisTickerLog::mLogBase
protected

Definition at line 1850 of file qcustomplot.h.

◆ mLogBaseLnInv

double QCPAxisTickerLog::mLogBaseLnInv
protected

Definition at line 1854 of file qcustomplot.h.

◆ mSubTickCount

int QCPAxisTickerLog::mSubTickCount
protected

Definition at line 1851 of file qcustomplot.h.


The documentation for this class was generated from the following files:


graph_rviz_plugin
Author(s): Édouard Pronier, Victor Lamoine - Institut Maupertuis
autogenerated on Mon Feb 28 2022 22:27:30