Commit 4d399fe674eac8c39a46e6be62a7ced8222b1375
1 parent
d6188c7f
Exists in
master
and in
9 other branches
#11681 - Done.
Showing
1 changed file
with
18 additions
and
4 deletions
Show diff stats
src/ParamOutputImpl/Plot/HistoPlot/Histo1DFunction.cc
... | ... | @@ -37,14 +37,17 @@ void Histo1DFunction::apply(std::shared_ptr<Histo1DFunction> functionToApply, st |
37 | 37 | double& xBinSize, bool yIsLog, double& yMin, double& yMax) |
38 | 38 | { |
39 | 39 | bool yMaxToModify=true; |
40 | + bool yMinToModify=true; | |
40 | 41 | if(!_cacheGrid.empty()){ |
41 | 42 | grid = _cacheGrid; |
42 | 43 | return; |
43 | 44 | } |
44 | 45 | if(std::isnan(yMin)) |
45 | 46 | yMin = (yIsLog) ? 1 : 0; |
47 | + else | |
48 | + yMinToModify = false; | |
46 | 49 | if(std::isnan(yMax)) |
47 | - yMax = 0; | |
50 | + yMax = (yIsLog) ? 1 : 0; | |
48 | 51 | else |
49 | 52 | yMaxToModify = false; |
50 | 53 | std::map<int,std::vector<double>> allValues; |
... | ... | @@ -55,15 +58,26 @@ void Histo1DFunction::apply(std::shared_ptr<Histo1DFunction> functionToApply, st |
55 | 58 | |
56 | 59 | functionToApply->calculate(grid, allValues, xRange, xBinSize, yIsLog); |
57 | 60 | |
58 | - if(yMaxToModify) | |
61 | + if(yMaxToModify){ | |
59 | 62 | for(auto cell:grid){ |
60 | 63 | if(yMax < cell.second) |
61 | 64 | yMax = cell.second; |
65 | + } | |
66 | + if(yIsLog) | |
67 | + yMax = exp10(yMax); | |
68 | + } | |
69 | + | |
70 | + if(yMinToModify){ | |
71 | + for(auto cell:grid){ | |
62 | 72 | if(yMin > cell.second) |
63 | 73 | yMin = cell.second; |
64 | 74 | } |
65 | - if(yIsLog) | |
66 | - yMin = log10(yMin); | |
75 | + if(yIsLog) | |
76 | + yMin = exp10(yMin); | |
77 | + } | |
78 | + | |
79 | + | |
80 | + | |
67 | 81 | } |
68 | 82 | |
69 | 83 | // Density function for 1DHistogram | ... | ... |