Plot Styling

PyPlotUtility.get_figureFunction
get_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.

source
PyPlotUtility.plot_styling!Function
plot_styling!(;axis_label_font_size::Int64=20,
                    legend_font_size::Int64=15,
                    tick_label_size::Int64=15)

LMB default plot styling

source
PyPlotUtility.axis_ticks_styling!Function
axis_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.

source
PyPlotUtility.cb_ticks_styling!Function
cb_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.

source

Linestyles

PyPlotUtility.linestyleFunction
linestyle(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.
source
PyPlotUtility.lsFunction
ls(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

source

Colorbars

PyPlotUtility.get_colorbar_topFunction
get_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.

source
PyPlotUtility.get_colorbar_leftFunction
get_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.

source
PyPlotUtility.get_colorbar_rightFunction
get_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.

source
PyPlotUtility.shift_colorbar_label!Function
shift_colorbar_label!(cax::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"].

source

Gridspec

PyPlotUtility.get_gsFunction
get_gs(gs::PyObject, row, col)

Helper function to get the correct gridspec panel for a given (range of) row and col.

source

imshow

PyPlotUtility.get_imshowFunction
get_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.

source
PyPlotUtility.get_imshow_logFunction
get_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.

source

pcolormesh

PyPlotUtility.get_pcolormeshFunction
get_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 for pcolormesh.
  • set_bad::Bool=true: Whether to set invalid pixels to a different color.
  • bad_color::String="white": Color to use if set_bad=true.
source
PyPlotUtility.get_pcolormesh_logFunction
get_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 for pcolormesh.
  • set_bad::Bool=true: Whether to set invalid pixels to a different color.
  • bad_color::String="white": Color to use if set_bad=true.
source

streamlines

PyPlotUtility.get_streamlinesFunction
get_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 streamlines
  • color::String="grey": Color of the streamlines
source