本文整理匯總了Python中matplotlib.style.use方法的典型用法代碼示例。如果您正苦於以下問題:Python style.use方法的具體用法?Python style.use怎麽用?Python style.use使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類matplotlib.style
的用法示例。
在下文中一共展示了style.use方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: plot_distrib
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def plot_distrib(nn_intervals: List[float], bin_length: int = 8):
"""
Function plotting histogram distribution of the NN Intervals. Useful for geometrical features.
Arguments
---------
nn_intervals : list
list of Normal to Normal Interval.
bin_length : int
size of the bin for histogram in ms, by default = 8.
"""
max_nn_i = max(nn_intervals)
min_nn_i = min(nn_intervals)
style.use("seaborn-darkgrid")
plt.figure(figsize=(12, 8))
plt.title("Distribution of Rr Intervals", fontsize=20)
plt.xlabel("Time (s)", fontsize=15)
plt.ylabel("Number of Rr Interval per bin", fontsize=15)
plt.hist(nn_intervals, bins=range(min_nn_i - 10, max_nn_i + 10, bin_length), rwidth=0.8)
plt.show()
示例2: trackerInstance
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def trackerInstance(url):
item = Tracker(url)
data = ItemData(url)
style.use("fivethirtyeight")
item.graph()
if item.compare_prices() == 'below':
print(f'{item.price()} < ${item.target_price}\n')
comms = Communication(item.title().strip(), url, item.price(), '$' + item.target_price)
comms.sendEmail()
comms.sendText()
data.delFile()
elif item.compare_prices() == 'above':
print(f'{item.price()} > ${item.target_price}\n')
elif item.compare_prices() == 'out-of-stock':
print(f'{item.price()} > ${item.target_price} - Item is out of stock\n')
示例3: plot_timeseries
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def plot_timeseries(nn_intervals: List[float], normalize: bool = True,
autoscale: bool = True, y_min: float = None, y_max: float = None):
"""
Function plotting the NN-intervals time series.
Arguments
---------
nn_intervals : list
list of Normal to Normal Interval.
normalize : bool
Set to True to plot X axis as a cumulative sum of Time.
Set to False to plot X axis using x as index array 0, 1, ..., N-1.
autoscale : bool
Option to normalize the x-axis as a time series for comparison. Set to True by default.
y_min : float
Custom min value might be set for y axis.
y_max : float
Custom max value might be set for y axis.
"""
style.use("seaborn-darkgrid")
plt.figure(figsize=(12, 8))
plt.title("Rr Interval time series")
plt.ylabel("Rr Interval", fontsize=15)
if normalize:
plt.xlabel("Time (s)", fontsize=15)
plt.plot(np.cumsum(nn_intervals) / 1000, nn_intervals)
else:
plt.xlabel("RR-interval index", fontsize=15)
plt.plot(nn_intervals)
if not autoscale:
plt.ylim(y_min, y_max)
plt.show()
示例4: get_density_at_altitude
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def get_density_at_altitude(altitude):
# More efficient to do this using equation of state, but you can use this if you really want.
P = get_pressure_at_altitude(altitude)
T = get_temperature_at_altitude(altitude)
rho = P / (T * R_air)
return rho
示例5: xyzlim
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def xyzlim(vmin, vmax=None):
"""Set limits or all axis the same, if vmax not given, use [-vmin, vmin]."""
if vmax is None:
vmin, vmax = -vmin, vmin
xlim(vmin, vmax)
ylim(vmin, vmax)
zlim(vmin, vmax)
示例6: animate_glyphs
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def animate_glyphs(*args, **kwargs):
"""Deprecated: please use animation_control."""
warnings.warn("Please use animation_control(...)", DeprecationWarning, stacklevel=2)
animation_control(*args, **kwargs)
示例7: screenshot
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def screenshot(
width=None,
height=None,
format="png",
fig=None,
timeout_seconds=10,
output_widget=None,
headless=False,
devmode=False,
):
"""Save the figure to a PIL.Image object.
:param int width: the width of the image in pixels
:param int height: the height of the image in pixels
:param format: format of output data (png, jpeg or svg)
:type fig: ipyvolume.widgets.Figure or None
:param fig: if None use the current figure
:type timeout_seconds: int
:param timeout_seconds: maximum time to wait for image data to return
:type output_widget: ipywidgets.Output
:param output_widget: a widget to use as a context manager for capturing the data
:param bool headless: if True, use headless chrome to take screenshot
:param bool devmode: if True, attempt to get index.js from local js/dist folder
:return: PIL.Image
"""
assert format in ['png', 'jpeg', 'svg'], "image format must be png, jpeg or svg"
data = _screenshot_data(
timeout_seconds=timeout_seconds,
output_widget=output_widget,
format=format,
width=width,
height=height,
fig=fig,
headless=headless,
devmode=devmode,
)
f = StringIO(data)
return PIL.Image.open(f)
示例8: savefig
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def savefig(
filename, width=None, height=None, fig=None, timeout_seconds=10, output_widget=None, headless=False, devmode=False
):
"""Save the figure to an image file.
:param str filename: must have extension .png, .jpeg or .svg
:param int width: the width of the image in pixels
:param int height: the height of the image in pixels
:type fig: ipyvolume.widgets.Figure or None
:param fig: if None use the current figure
:param float timeout_seconds: maximum time to wait for image data to return
:param ipywidgets.Output output_widget: a widget to use as a context manager for capturing the data
:param bool headless: if True, use headless chrome to save figure
:param bool devmode: if True, attempt to get index.js from local js/dist folder
"""
__, ext = os.path.splitext(filename)
format = ext[1:]
assert format in ['png', 'jpeg', 'svg'], "image format must be png, jpeg or svg"
with open(filename, "wb") as f:
f.write(
_screenshot_data(
timeout_seconds=timeout_seconds,
output_widget=output_widget,
format=format,
width=width,
height=height,
fig=fig,
headless=headless,
devmode=devmode,
)
)
示例9: _axes
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def _axes(which=None, **values):
if which:
style.use({'axes': {name: values for name in which}})
else:
style.use({'axes': values})
示例10: box_on
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def box_on():
"""Draw a box around the visible volume."""
style.use({'box': {'visible': True}})
示例11: background_color
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def background_color(color):
"""Set the background color."""
style.use({'background-color': color})
示例12: closure
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def closure(style_name=style_name):
def quick_set():
style.use(style_name)
attr_name = 'set_style_' + style_name
attr = staticmethod(quick_set)
setattr(style, attr_name, attr)
getattr(style, attr_name).__doc__ = """Short for style.use(%r)""" % style_name
示例13: apply_style
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def apply_style(is_dark):
"""Assign a light or dark style to mpl plots."""
pth = Path(__file__).resolve().parent
styles_dir = Path(pth / 'styles')
if is_dark:
style_path = styles_dir / 'Solarize_Dark.mplstyle'
style.use(str(style_path))
else:
style_path = styles_dir / 'Solarize_Light_Blue.mplstyle'
style.use(str(style_path))
示例14: setting
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def setting(self):
style.use('ggplot')
plt.rcParams['lines.linewidth'] = 1.4
plt.rcParams['figure.figsize'] = 6, 10
示例15: __init__
# 需要導入模塊: from matplotlib import style [as 別名]
# 或者: from matplotlib.style import use [as 別名]
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
label = tk.Label(self, text="""The Sea of BTC trading client is a client intended to help traders
interact with their exchanges. We do this by allowing you to enter
your API keys into the program. We, as in Sea of BTC, never
see your API information. The program may save them locally, however,
to make things easier on you. Keep in mind that it is a fantastic idea
to enable 'IP Whitelisting' if your exchange supports it, and only allow
trading via your specific IP address. On most exchanges, even if someone
was to acquire your API key, withdrawals are not possible. Some still
give the option, so make sure this is turned OFF if your exchange allows it.
Sea of BTC makes no promise of warranty, satisfaction, performance, or
anything else. Understand that your use of this client is completely
at your own risk.""", font=TITLE_FONT)
label.pack(side="top", fill="x", pady=10)
button1 = ttk.Button(self, text="Agree",
command=lambda: controller.show_frame(dashboard))
button2 = ttk.Button(self, text="Disagree",
command=quit)
button1.pack()
button2.pack()
### Deprecated, lost the point of needing this page leaving mostly for future reference.
##class HomePage(tk.Frame):
## def __init__(self, parent, controller):
## tk.Frame.__init__(self, parent)
##
## label = tk.Label(self, text="Sea of BTC Client", font=TITLE_FONT)
## label.pack(side="top", fill="x", pady=10)
## label = tk.Label(self, text="Choose your Exchange", font=NORM_FONT)
## label.pack(side="top", fill="x", pady=10)
##
##
## button = ttk.Button(self, text="BTC-e",
## command=lambda: controller.show_frame(BTCe_main))
## button.pack(pady=10)
##
## button = ttk.Button(self, text="*NOT ACTIVE* Bitstamp",
## command=lambda: controller.show_frame(StartPage))
## button.pack(pady=10)
##
## button = ttk.Button(self, text="*NOT ACTIVE* Bitfinex",
## command=lambda: controller.show_frame(StartPage))
## button.pack(pady=10)
##
## button = ttk.Button(self, text="*NOT ACTIVE* Huobi",
## command=lambda: controller.show_frame(StartPage))
## button.pack(pady=10)