-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path_plot_iota.py
54 lines (46 loc) · 1.61 KB
/
_plot_iota.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
def plot_iota(self, xaxis="R", yaxis="i", ax=None, **kwargs):
"""Iota plots
@param xaxis the choose of the xaxis, 'R'(default) or 's'
@param yaxis the choose of the yaxis, 'i'(default) or 'q'
@param ax (Matplotlib axis, optional): Matplotlib axis to be plotted on. Defaults to None.
@param kwargs (dict, optional): keyword arguments. Matplotlib.pyplot.scatter keyword arguments.
@raises ValueError: xaxis or yaxis illegal
@returns pyplot.scatter: Matplotlib.pyplot.scatter returns
"""
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import numpy as np
if ax is None:
fig, ax = plt.subplots()
plt.sca(ax)
# set default plotting parameters
# use dots
if "marker" not in kwargs:
kwargs.update({"marker": "*"})
# use gray color
if "c" not in kwargs:
pass
# kwargs.update({"c": "gray"})
if xaxis == "s":
xdata = self.transform.fiota[0, :]
ydata = self.transform.fiota[1, :]
xlabel = r"s"
elif xaxis == "R":
xdata = self.poincare.R[:, 0, 0]
ydata = self.transform.fiota[1, self.poincare.success == 1]
xlabel = r"R"
else:
raise ValueError("xaxis should be one of ['R', 's'].")
if yaxis == "i":
ylabel = r"$\iota$"
elif yaxis == "q":
ydata = 1.0 / ydata
ylabel = r"q"
else:
raise ValueError("yaxis should be one of ['i', 'q'].")
dots = ax.scatter(xdata, ydata, **kwargs)
plt.xlabel(xlabel, fontsize=20)
plt.ylabel(ylabel, fontsize=20)
plt.xticks(fontsize=16)
plt.yticks(fontsize=16)
return