Skip to content
Snippets Groups Projects
Commit fbb69029 authored by tobiglaser's avatar tobiglaser
Browse files

better logarithmic scaling

parent 32089b95
No related merge requests found
...@@ -507,7 +507,13 @@ void Control::resizeAxes(int plot) ...@@ -507,7 +507,13 @@ void Control::resizeAxes(int plot)
{ {
if (logAxis) if (logAxis)
{ {
axis->setRange(std::max(0.0000001, 0.8 * minX), 1.2 * maxX); minX = std::max(minX, 1E-16);
maxX = std::max(maxX, 1E-15);
double lower = floor(log10(minX));
double upper = ceil(log10(maxX));
axis->setRange(pow(10, lower), pow(10, upper));
} }
else else
{ {
...@@ -519,7 +525,13 @@ void Control::resizeAxes(int plot) ...@@ -519,7 +525,13 @@ void Control::resizeAxes(int plot)
{ {
if (logAxis) if (logAxis)
{ {
axis->setRange(std::max(0.0000001, 0.8 * minY), 1.2 * maxY); minY = std::max(minY, 1E-16);
maxY = std::max(maxY, 1E-15);
double lower = floor(log10(minY));
double upper = ceil(log10(maxY));
axis->setRange(pow(10, lower), pow(10, upper));
} }
else else
{ {
...@@ -618,7 +630,7 @@ void Control::setPlotScale(int plot, int x, int y) ...@@ -618,7 +630,7 @@ void Control::setPlotScale(int plot, int x, int y)
QLogValueAxis* newLogAxis = new QLogValueAxis(); QLogValueAxis* newLogAxis = new QLogValueAxis();
newLogAxis->setBase(10.0); newLogAxis->setBase(10.0);
newLogAxis->setMax(std::max(linAxis->max(), 0.1)); newLogAxis->setMax(std::max(linAxis->max(), 0.1));
newLogAxis->setMin(std::max(linAxis->min(), 0.000001)); newLogAxis->setMin(std::max(linAxis->min(), (double)(1.0E-16)));
newLogAxis->setVisible(linAxis->isVisible()); newLogAxis->setVisible(linAxis->isVisible());
newLogAxis->setTitleFont(linAxis->titleFont()); newLogAxis->setTitleFont(linAxis->titleFont());
newLogAxis->setTitleText(linAxis->titleText()); newLogAxis->setTitleText(linAxis->titleText());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment