Plot Styling
PyPlotUtility.get_figure
— Functionget_figure(aspect_ratio::Float64=1.1; x_pixels::Int64=600)
Get a Figure
object with a given aspect ratio for a fixed number of pixels in x-diretion.
PyPlotUtility.plot_styling!
— Functionplot_styling!(;axis_label_font_size::Int64=20,
legend_font_size::Int64=15,
tick_label_size::Int64=15)
LMB default plot styling
PyPlotUtility.axis_ticks_styling!
— Functionaxis_ticks_styling!(ax::PyCall.PyObject; size_minor_ticks::Int64=6,
width_minor_ticks::Int64=1, major_tick_width_scale::Int64=1,
tick_label_size::Int64=15, color::String="k")
LMB default axis tick styling.
PyPlotUtility.cb_ticks_styling!
— Functioncb_ticks_styling!(ax::PyCall.PyObject; size_minor_ticks::Int64=6,
width_minor_ticks::Int64=1, major_tick_width_scale::Int64=1,
tick_label_size::Int64=15, color::String="k")
LMB default colorbar tick styling.
PyPlotUtility.pixel_size
— Functionpixel_size(fig::Figure)
Helper function to get markers with size 1 pixel.
Linestyles
PyPlotUtility.linestyle
— Functionlinestyle(sequence::String="";
dash::Real=3.7, dot::Real=1.0, space::Real=3.7,
buffer::Bool=false, offset::Int=0)
Get custom IDL
-like linestyles. sequence
has to be an even number of entries.
Keyword Arguments
dash::Real=3.7
: Size of dash.dot::Real=1.0
: Size of dot.space::Real=3.7
: Size of space.buffer::Bool=false
: Whether to add a buffer to the end of the sequence.offset::Int=0
: No clue.
PyPlotUtility.ls
— Functionls(sequence::String="";
dash::Real=3.7, dot::Real=1.0, space::Real=3.7,
buffer::Bool=false, offset::Int=0)
Get custom IDL
-like linestyles. sequence
has to be an even number of entries. See also linestyle
Colorbars
PyPlotUtility.get_colorbar_top
— Functionget_colorbar_top(ax::PyCall.PyObject, im::PyCall.PyObject,
label::AbstractString,
axis_label_font_size::Integer,
tick_label_size::Integer)
Returns a colorbar at the top of a plot.
PyPlotUtility.get_colorbar_left
— Functionget_colorbar_left(ax::PyCall.PyObject, im::PyCall.PyObject,
label::AbstractString,
axis_label_font_size::Integer,
tick_label_size::Integer)
Returns a colorbar at the left of a plot.
PyPlotUtility.get_colorbar_right
— Functionget_colorbar_right(ax::PyCall.PyObject, im::PyCall.PyObject,
label::AbstractString,
axis_label_font_size::Integer,
tick_label_size::Integer)
Returns a colorbar at the right of a plot.
PyPlotUtility.shift_colorbar_label!
— Functionshift_colorbar_label!(cax1::PyCall.PyObject, shift::String)
Shift a colorbar label at the left ["left", "l"]
of the colorbar to the right, or vice versa with ["right", "r"]
.
Gridspec
PyPlotUtility.get_gs
— Functionget_gs(gs::PyObject, row, col)
Helper function to get the correct gridspec
panel for a given (range of) row
and col
.
PyPlotUtility.slice
— Functionslice(rng::UnitRange)
Helper function to convert Julia
UnitRange
to Python
slice
.
imshow
PyPlotUtility.get_imshow
— Functionget_imshow(ax::PyCall.PyObject, image::Array{<:Real},
x_lim::Array{<:Real}=zeros(2), y_lim::Array{<:Real}=zeros(2),
vmin::Real=0.0, vmax::Real=0.0;
cmap::String="viridis", cnorm=matplotlib.colors.NoNorm(),
ticks_color::String="white",
interpolation::String="none")
Helper function to plot an imshow
with linear colorbar.
PyPlotUtility.get_imshow_log
— Functionget_imshow_log(ax::PyCall.PyObject, image::Array{<:Real},
x_lim::Array{<:Real}=zeros(2), y_lim::Array{<:Real}=zeros(2),
vmin::Real=0.0, vmax::Real=0.0;
cmap::String="viridis",
ticks_color::String="white",
interpolation::String="none")
Helper function to plot an imshow
with logarithmic colorbar.
pcolormesh
PyPlotUtility.get_pcolormesh
— Functionget_pcolormesh( map, x_lim, y_lim, c_lim=nothing;
image_cmap="plasma", cnorm=matplotlib.colors.LogNorm(),
set_bad::Bool=true, bad_color::String="white" )
Plot a pcolormesh of map
with linear xy-axis given by x_lim
, y_lim
. If c_lim
is not defined the colorbar is limited by minimum and maximum of the map
.
Keyword Arguments:
image_cmap="plasma"
: Name of the colormap to use.cnorm=matplotlib.colors.LogNorm()
: Norm forpcolormesh
.set_bad::Bool=true
: Whether to set invalid pixels to a different color.bad_color::String="white"
: Color to use ifset_bad=true
.
PyPlotUtility.get_pcolormesh_log
— Functionget_pcolormesh_log( map, x_lim, y_lim, c_lim=nothing;
image_cmap="plasma", cnorm=matplotlib.colors.LogNorm(),
set_bad::Bool=true, bad_color::String="white" )
Plot a pcolormesh of map
with logarithmic xy-axis given by x_lim
, y_lim
. If c_lim
is not defined the colorbar is limited by minimum and maximum of the map
.
Keyword Arguments:
image_cmap="plasma"
: Name of the colormap to use.cnorm=matplotlib.colors.LogNorm()
: Norm forpcolormesh
.set_bad::Bool=true
: Whether to set invalid pixels to a different color.bad_color::String="white"
: Color to use ifset_bad=true
.
streamlines
PyPlotUtility.get_streamlines
— Functionget_streamlines( ax::PyCall.PyObject,
image_x::Array{<:Real}, image_y::Array{<:Real},
par::mappingParameters;
scale::Real=1.0, density::Real=2.0, color::String="grey")
Plot streamlines of axis ax
. Takes gridded images in x- and y-directions image_x
, image_y
and reconstructs their corresponding xy-positions from par
. Returns the streamplot
object.
Keyword arguments:
scale::Real=1.0
: conversion scale for xy-coordinates (e.g.scale=1.e-3
for kpc -> Mpc)density::Real=2.0
: Line density of streamlinescolor::String="grey"
: Color of the streamlines