aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/algorithms/plotter.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-06-25 05:52:06 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-06-25 05:52:06 +0300
commit11075f01cf629a6e14cac9637c87709f36af3ab6 (patch)
tree94509ce5db3af20f6db2215e3406947619472c08 /algorithms/plotter.py
parentimprove command line parsing errors (diff)
downloadsorting-algorithms-11075f01cf629a6e14cac9637c87709f36af3ab6.tar.gz
sorting-algorithms-11075f01cf629a6e14cac9637c87709f36af3ab6.zip
scientific notation by default in plots
Diffstat (limited to 'algorithms/plotter.py')
-rw-r--r--algorithms/plotter.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/algorithms/plotter.py b/algorithms/plotter.py
index 048894f..58ee941 100644
--- a/algorithms/plotter.py
+++ b/algorithms/plotter.py
@@ -14,6 +14,10 @@ class PlotBuilder:
plt.ylabel(s)
@staticmethod
+ def set_yticklabels_scientific():
+ plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0))
+
+ @staticmethod
def show_grid():
plt.grid()
@@ -34,5 +38,8 @@ class PlotBuilder:
plt.show()
@staticmethod
- def save(output_path):
- plt.savefig(output_path)#, bbox_inches='tight')
+ def save(output_path, tight=False):
+ if tight:
+ plt.savefig(output_path, bbox_inches='tight')
+ else:
+ plt.savefig(output_path)