From a8ac6ee3d2f826d5f15ea4053325221ac46907e4 Mon Sep 17 00:00:00 2001
From: Daniel Brown <ddb@star.sr.bham.ac.uk>
Date: Tue, 8 Dec 2015 16:56:54 +0000
Subject: [PATCH] adding in styles argument

---
 bin/test_plot.py |  6 +++---
 pykat/finesse.py | 14 +++++++++-----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/bin/test_plot.py b/bin/test_plot.py
index b1938ed..9c601dc 100644
--- a/bin/test_plot.py
+++ b/bin/test_plot.py
@@ -1,5 +1,5 @@
 import pykat
-pykat.init_pykat_plotting()
+#pykat.init_pykat_plotting()
 
 from pykat import finesse
 from pykat.detectors import *
@@ -32,7 +32,7 @@ attr m1 Rc 1
 kat = finesse.kat()
 kat.parseCommands(code)
 
-kat.add(xaxis("log", [1, 360], kat.m2.phi, 500))
+kat.add(xaxis("lin", [1, 360], kat.m2.phi, 500))
 
 kat.m1.Rcx = -1000.0
 kat.m1.Rcy = -1000.0
@@ -43,4 +43,4 @@ kat.maxtem = 0
 
 out = kat.run()
 
-fig = out.plot()
\ No newline at end of file
+fig = out.plot(styles={'circ':'c:'}, yaxis="log abs:deg")
\ No newline at end of file
diff --git a/pykat/finesse.py b/pykat/finesse.py
index 43cf7d5..881be1d 100644
--- a/pykat/finesse.py
+++ b/pykat/finesse.py
@@ -259,7 +259,7 @@ class katRun(object):
             print("One xaxis used: %s" % kat.xaxis.getFinesseText())
         
         
-    def plot(self, detectors=None, filename=None, show=True, yaxis=None, legend=True, loc=0, title=None):
+    def plot(self, detectors=None, filename=None, show=True, yaxis=None, legend=True, loc=0, title=None, styles=None):
         """
         This will generate a plot for the output data of this particular pykat run.
         It will attempt to generate a plot that shows all the various traces and plots
@@ -275,6 +275,7 @@ class katRun(object):
             legend: True | False - whether to include a legend
             loc: Location value for the legend, the usual matplotlib one.
             title: Provide a title for the plot if required.
+            styles: A dictionary which keys being the detector names and the value being a colour and linestyle of the sort 'k:'
         """
         import matplotlib.pyplot as pyplot
         import pykat.plotting as plt
@@ -349,12 +350,15 @@ class katRun(object):
         
         for det in detectors:
             if not getattr(kat, det).noplot:
-                if not dual_plot:
-                    plot_cmd1(self.x, _func1(self[det]), label=det)
-                else:
+                if dual_plot:
                     ax = pyplot.subplot(2,1,1)
+                    
+                if styles is not None and det in styles:
+                    l, = plot_cmd1(self.x, _func1(self[det]), styles[det], label=det)
+                else:
                     l, = plot_cmd1(self.x, _func1(self[det]), label=det)
-        
+                
+                if dual_plot: 
                     pyplot.subplot(2,1,2)
                     plot_cmd2(self.x, _func2(self[det]), color=l.get_color(), ls=l.get_linestyle(), label=det)
 
-- 
GitLab