8000 correct behaviour for logplots when only y is given · Cryoris/matplotlib-cpp@6d3c54e · GitHub
[go: up one dir, main page]

Skip to content

Commit 6d3c54e

Browse files
committed
correct behaviour for logplots when only y is given
had x = 1...N before to avoid problems with x=0 but matplotlib states it should still be x = 0...N-1
1 parent 9cdd5ae commit 6d3c54e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

matplotlibcpp.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ bool loglog(const VectorY &y, const std::string &s = "",
534534
const std::map<std::string, std::string> &keywords = {}) {
535535
std::vector<std::size_t> x(y.size());
536536
for (std::size_t i = 0; i < x.size(); ++i)
537-
x.at(i) = i + 1; // in loglog scale the values shouldn't be zero
537+
x.at(i) = i;
538538

539539
return loglog(x, y, s, keywords);
540540
}
@@ -544,7 +544,7 @@ bool loglog(const VectorY &y,
544544
const std::map<std::string, std::string> &keywords) {
545545
std::vector<std::size_t> x(y.size());
546546
for (std::size_t i = 0; i < x.size(); ++i)
547-
x.at(i) = i + 1; // in loglog scale the values shouldn't be zero
547+
x.at(i) = i;
548548

549549
return loglog(x, y, "", keywords);
550550
}
@@ -568,7 +568,7 @@ bool semilogx(const VectorY &y, const std::string &s = "",
568568
const std::map<std::string, std::string> &keywords = {}) {
569569
std::vector<std::size_t> x(y.size());
570570
for (std::size_t i = 0; i < x.size(); ++i)
571-
x.at(i) = i + 1; // in semilogx scale the values shouldn't be zero
571+
x.at(i) = i;
572572

573573
return semilogx(x, y, s, keywords);
574574
}
@@ -578,7 +578,7 @@ bool semilogx(const VectorY &y,
578578
const std::map<std::string, std::string> &keywords) {
579579
std::vector<std::size_t> x(y.size());
580580
for (std::size_t i = 0; i < x.size(); ++i)
581-
x.at(i) = i + 1; // in semilogx scale the values shouldn't be zero
581+
x.at(i) = i;
582582

583583
return semilogx(x, y, "", keywords);
584584
}
@@ -602,7 +602,7 @@ bool semilogy(const VectorY &y, const std::string &s = "",
602602
const std::map<std::string, std::string> &keywords = {}) {
603603
std::vector<std::size_t> x(y.size());
604604
for (std::size_t i = 0; i < x.size(); ++i)
605-
x.at(i) = i + 1; // in semilogx scale the values shouldn't be zero
605+
x.at(i) = i;
606606

607607
return semilogy(x, y, s, keywords);
608608
}
@@ -612,7 +612,7 @@ bool semilogy(const VectorY &y,
612612
const std::map<std::string, std::string> &keywords) {
613613
std::vector<std::size_t> x(y.size());
614614
for (std::size_t i = 0; i < x.size(); ++i)
615-
x.at(i) = i + 1; // in semilogx scale the values shouldn't be zero
615+
x.at(i) = i;
616616

617617
return semilogy(x, y, "", keywords);
618618
}

0 commit comments

Comments
 (0)
0