Routines to get a sane default configuration for production quality plots.
Project description
cosmoplots
Routines to get a sane default configuration for production quality plots. Used by complex systems modelling group at UiT.
Installation
pip install cosmoplots
Use
Set your rcparams
before plotting in your code, for example:
from cosmoplots import figure_defs
axes_size = figure_defs.set_rcparams_aip(plt.rcParams, num_cols=1, ls="thin")
change_log_axis_base
import matplotlib.pyplot as plt
import numpy as np
import cosmoplots
axes_size = cosmoplots.set_rcparams_aip(plt.rcParams, num_cols=1, ls="thin")
a = np.exp(np.linspace(-3, 5, 100))
# 1 --- Semilogx
fig = plt.figure()
ax = fig.add_axes(axes_size)
base = 2 # Default is 10, but 2 works equally well
cosmoplots.change_log_axis_base(ax, "x", base=base)
# Do plotting ...
# If you use "plot", the change_log_axis_base can be called at the top (along with add_axes
# etc.), but using loglog, semilogx, semilogy will re-set, and the change_log_axis_base
# function must be called again.
ax.plot(a)
plt.show()
# 2 --- Semilogy
fig = plt.figure()
ax = fig.add_axes(axes_size)
cosmoplots.change_log_axis_base(ax, "y")
# Do plotting ...
# If you use "plot", the change_log_axis_base can be called at the top (along with add_axes
# etc.), but using loglog, semilogx, semilogy will re-set, and the change_log_axis_base
# function must be called again.
ax.semilogy(a)
cosmoplots.change_log_axis_base(ax, "y") # Commenting out this result in the default base10 ticks
plt.show()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cosmoplots-0.1.1.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for cosmoplots-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95acd04561caed7599a0da66f9d3af1496516ee8c040dd24bec4e852f5663be0 |
|
MD5 | a9560cf7adead3e8667ae488d7dedff1 |
|
BLAKE2b-256 | aa700b4bc1240a976e1d83c662e4c099160f156c43f3a0357596adb9a9c245c2 |