Skip to content

Commit

Permalink
If only marker data is present in plot, treat as if no data is presen…
Browse files Browse the repository at this point in the history
…t at all.
  • Loading branch information
highperformancecoder committed Mar 15, 2024
1 parent 130f9de commit d288a6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/plot.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace ecolab
bool displayRHSscale() const {return !penSide.empty() && miny1<maxy1;}
bool displayLHSscale() const {return miny<maxy;}
string axisLabel(double x, double scale, bool percent=false) const;

bool onlyMarkers() const; ///< return true if the only data is marker data
public:
Plot(): palette(paletteSz), msg(NULL), nxTicks(30), nyTicks(30), fontScale(1),
offx(0), offy(0), logx(false), logy(false),
Expand Down
9 changes: 8 additions & 1 deletion src/plot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,21 @@ namespace ecolab
penSide[pen]=side;
}

bool Plot::onlyMarkers() const
{
bool r=true;
for (size_t i=0; i<x.size(); ++i)
r &= x[i].empty() || (i<penSide.size() && penSide[i]==marker);
return r;
}

void Plot::setMinMax()
{
assert(x.size()==y.size());
msg=NULL;

// calculate min/max
if (x.empty() || (!penSide.empty() && penSide[0]==marker))
if (onlyMarkers())
{
minx=logx? 0.1: -1;
maxx=1;
Expand Down

0 comments on commit d288a6e

Please sign in to comment.