diff --git a/plotLaTeX/line_plot.py b/plotLaTeX/line_plot.py index daeb0b1..f904cac 100644 --- a/plotLaTeX/line_plot.py +++ b/plotLaTeX/line_plot.py @@ -34,7 +34,7 @@ def add_yvals(self, y_vals, y_name): self.data_info() def export(self, path="", f_name="line_results.csv"): - if self.x_vals == None: + if self.x_vals is None or len(self.x_vals) == 0: self.data_stack["x"] = np.arange(self.n_y_vals) self.f_name = f_name print("**Export**\n") diff --git a/plotLaTeX/stem_plot.py b/plotLaTeX/stem_plot.py index c38173c..10ae9fd 100644 --- a/plotLaTeX/stem_plot.py +++ b/plotLaTeX/stem_plot.py @@ -56,7 +56,7 @@ def LaTeXcode(self, imports=False, caption="Stem plot caption."): print(f" ymax={np.max(self.y_vals)+1.0},") print(f" xmin={np.min(self.x_vals)-0.5},") print(f" xmax={np.max(self.x_vals)+0.5},") - y_ticks = np.arange(np.min(self.y_vals), np.max(self.y_vals)) + y_ticks = np.arange(np.min(self.y_vals), np.max(self.y_vals) + 1) print(r" xtick={" + ",".join(map(str, self.x_vals)) + "},") print(r" ytick={" + ",".join(map(str, y_ticks)) + "},")