mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
log scale basis in plots
This commit is contained in:
parent
13fddf4947
commit
6739019c83
@ -515,14 +515,16 @@ void Dash::operator()(PlotOptions &option) const
|
||||
}
|
||||
|
||||
// LogScale constructor ////////////////////////////////////////////////////////
|
||||
LogScale::LogScale(const Axis axis)
|
||||
LogScale::LogScale(const Axis axis, const double basis)
|
||||
: axis_(axis)
|
||||
, basis_(basis)
|
||||
{}
|
||||
|
||||
// Logscale modifier ///////////////////////////////////////////////////////////
|
||||
void LogScale::operator()(PlotOptions &option) const
|
||||
{
|
||||
option.scaleMode[static_cast<int>(axis_)] |= Plot::Scale::log;
|
||||
option.scaleMode[static_cast<int>(axis_)] |= Plot::Scale::log;
|
||||
option.logScaleBasis[static_cast<int>(axis_)] = basis_;
|
||||
}
|
||||
|
||||
// PlotRange constructors //////////////////////////////////////////////////////
|
||||
@ -915,11 +917,11 @@ ostream & Latan::operator<<(ostream &out, const Plot &plot)
|
||||
out << "unset log" << endl;
|
||||
if (plot.options_.scaleMode[x] & Plot::Scale::log)
|
||||
{
|
||||
out << "set log x" << endl;
|
||||
out << "set log x " << plot.options_.logScaleBasis[x] << endl;;
|
||||
}
|
||||
if (plot.options_.scaleMode[y] & Plot::Scale::log)
|
||||
{
|
||||
out << "set log y" << endl;
|
||||
out << "set log y " << plot.options_.logScaleBasis[y] << endl;
|
||||
}
|
||||
if (!plot.options_.label[x].empty())
|
||||
{
|
||||
|
@ -227,6 +227,7 @@ struct PlotOptions
|
||||
std::string caption;
|
||||
std::string title;
|
||||
unsigned int scaleMode[2];
|
||||
double logScaleBasis[2];
|
||||
Range scale[2];
|
||||
std::string label[2];
|
||||
std::string lineColor;
|
||||
@ -314,13 +315,14 @@ class LogScale: public PlotModifier
|
||||
{
|
||||
public:
|
||||
// constructor
|
||||
explicit LogScale(const Axis axis);
|
||||
explicit LogScale(const Axis axis, const double basis = 10);
|
||||
// destructor
|
||||
virtual ~LogScale(void) = default;
|
||||
// modifier
|
||||
virtual void operator()(PlotOptions &option) const;
|
||||
private:
|
||||
const Axis axis_;
|
||||
const double basis_;
|
||||
};
|
||||
|
||||
class PlotRange: public PlotModifier
|
||||
|
Loading…
Reference in New Issue
Block a user