Post processing functions

These functions are used internally and none are exported.

A post-processing function must take a Makie figure, add something to it, and return how to label the additions (or nothing when no new labels should be drawn).

Expected signature:

  post_processing(figure, args...; kwargs...) -> ([marker, ...], [label, ...])

where:

  • figure::Makie.Figure
  • marker::LegendElement
  • label::String

GalaxyInspector.ppAgertz2021!Method
ppAgertz2021!(
    figure::Makie.Figure;
    <keyword arguments>
)::Tuple{Vector{<:LegendElement},Vector{AbstractString}}

Draw a line plot using the experimental data and fits from McMillan (2011) and Leroy et al. (2008), show in Agertz et al. (2021). for the stellar density profile.

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.

  • galaxies::Vector=["MW"]: Target galaxies. The options are:

    • One of the 23 galaxies in Leroy et al. (2008), e.g. "DDO154", "HOI", "HOII", "IC2574", "NGC0628", "NGC0925", etc. For a full list see the reference below.
    • :all: All 23 galaxies in the dataset of Leroy et al. (2008) (this options will plot the data as an single color scatter plot with transparency).
    • "MW": The Milky Way fits from McMillan (2011).
  • x_unit::Unitful.Units=u"kpc": Unit for the x axis.

  • y_unit::Unitful.Units=u"Msun * kpc^-2": Unit for the y axis.

  • x_log::Bool=false: If the x axis will be plotted as the log10 of the galactocentric radius.

  • y_log::Bool=true: If the y axis will be plotted as the log10 of the stellar surface density.

  • error_band::Bool=true: If the error band will be plotted.

  • colors::Vector{<:ColorType}=[Makie.wong_colors()[2]]: Colors for the lines.

  • linestyle::LineStyleType=nothing: Style of the lines. nothing will produce a solid line.

  • linewidth::Int=3: Width of the lines.

Returns

  • A tuple with the elements for the legend:

    • A vector of LineElement.
    • A vector of labels.

References

O. Agertz et al. (2021). VINTERGATAN – I. The origins of chemically, kinematically, and structurally distinct discs in a simulated Milky Way-mass galaxy. Monthly Notices of the Royal Astronomical Society. **503(4), 5826–5845. doi:10.1093/mnras/stab322

A. K. Leroy et al. (2008). THE STAR FORMATION EFFICIENCY IN NEARBY GALAXIES: MEASURING WHERE GAS FORMS STARS EFFECTIVELY. The Astronomical Journal 136(6), 2782–2845. doi:10.1088/0004-6256/136/6/2782

P. J. McMillan (2011). Mass models of the Milky Way. Monthly Notices of the Royal Astronomical Society 414(3), 2446–2457. doi:10.1111/j.1365-2966.2011.18564.x

source
GalaxyInspector.ppAnnotation!Method
ppAnnotation!(figure::Makie.Figure, text::AbstractString; <keyword arguments>)::Nothing

Add an annotation to the plot.

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.
  • text::AbstractString: Text to be written.
  • position::Tuple{<:Real,<:Real}=(0.04, 0.98): Relative position of the top left corner of the text box.
  • color=:black: Text color.
  • fontsize::Int=35: Font size.
source
GalaxyInspector.ppArrows!Method
ppArrows!(
    figure::Makie.Figure,
    positions::Vector{NTuple{4,Float64}};
    <keyword arguments>
)::Nothing

Draw arrows.

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.
  • positions::Vector{NTuple{4,Float64}}: The x, y, u, and v coordinates of the arrows. x and y indicate the position of the tails, and u and v the position of the point of the arrows.
  • colors::Vector{<:ColorType}=[:red]: Colors of the arrows.
source
GalaxyInspector.ppBarPlotLabelsMethod
ppBarPlotLabels(
    ::Makie.Figure,
    include_stars::Bool;
    <keyword arguments>
)::Tuple{Vector{<:LegendElement},Vector{AbstractString}}

Return the legend elements for the plot made by gasBarPlot.

Arguments

  • ::Makie.Figure: Makie figure to be drawn over.
  • include_stars::Bool=false: If the stars will be included as one of the gas phases.
  • colors=Makie.wong_colors(): Colors for the bars.

Returns

  • A tuple with the elements for the legend:

    • A PolyElement to be used in the legend.
    • The label strings.
source
GalaxyInspector.ppBigiel2008!Method
ppBigiel2008!(
    figure::Makie.Figure,
    molecular::Bool;
    <keyword arguments>
)::Union{Tuple{Vector{<:LegendElement},Vector{AbstractString}},Nothing}

Draw a line plot with the fit for the KS law, taken from Bigiel et al. (2008).

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.
  • molecular::Bool: If the x axis will be the area mass density of molecular hydrogen, or, if set to false, the area mass density of neutral hydrogen.
  • x_unit::Unitful.Units=u"Msun * pc^-2": Unit for the area density of gas used in figure.
  • y_unit::Unitful.Units=u"Msun * yr^-1 * kpc^-2": Unit for the area density of star formation rate used in figure.
  • x_log::Bool=true: If the x axis is $\log_{10}(\Sigma_\mathrm{H})$ (x_log = true) or just $\Sigma_\mathrm{H}$ (x_log = false).
  • y_log::Bool=true: If the y axis is $\log_{10}(\Sigma_\mathrm{SFR})$ (y_log = true) or just $\Sigma_\mathrm{SFR}$ (y_log = false).
  • extend::Float64=0.0: By default the y axis limits will be the vertical range of the points in the plot. This can be extended by the multiplicative factor extend of the vertical range.
  • colors::Vector{<:ColorType}=[Makie.wong_colors()[6], Makie.wong_colors()[7]]: Colors for the line. The first color will indicate the range for which there are experimental data, and the second color will be for the extrapolation.
  • linestyle::LineStyleType=nothing: Style of the line. nothing will produce a solid line.
  • linewidth::Int=3: Line width.

Returns

  • A tuple with the elements for the legend:

    • A LineElement to be used as the marker.
    • The label string.

References

F. Bigiel et al. (2008). THE STAR FORMATION LAW IN NEARBY GALAXIES ON SUB-KPC SCALES. The Astrophysical Journal, 136(6), 2846. doi:10.1088/0004-6256/136/6/2846

source
GalaxyInspector.ppBigiel2010!Method
ppBigiel2010!(
    figure::Makie.Figure;
    <keyword arguments>
)::Tuple{Vector{<:LegendElement},Vector{AbstractString}}

Draw a scatter plot of the SFR surface density vs gas surface density (Kennicutt-Schmidt law) for a given galaxy, using the data of Bigiel et al. (2010).

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.

  • galaxy::Union{String,Symbol}="NGC 628": Target galaxy. The options are:

    • With molecular and and atomic data (Table 2): "NGC 628", "NGC 3184", "NGC 3521", "NGC 4736", "NGC 5055", "NGC 5194", "NGC 6946".
    • With only atomic data (Table 3): "NGC 925", "NGC 2403", "NGC 2841", "NGC 2903", "NGC 3198", "NGC 3351", "NGC 3621", "NGC 3627", "NGC 5236", "NGC 5457", "NGC 7331", "NGC 7793".
    • :all: Every galaxy that is available for the given quantity.

    For more information on each galaxy see Bigiel et al. (2010).

  • quantity::Symbol=:molecular: Gas quantity for the x axis. The options are:

    • :molecular -> Surface density of molecular gas.
    • :neutral -> Surface density of neutral gas.
    • :atomic -> Surface density of atomic gas.
  • x_log::Bool=true: If the x axis will be plotted as the log10 of the gas surface density.

  • y_log::Bool=true: If the y axis will be plotted as the log10 of the SFR surface density.

  • x_unit::Unitful.Units=u"Msun * kpc^-2": Unit for the x axis.

  • y_unit::Unitful.Units=u"Msun * yr^-1 * kpc^-2": Unit for the y axis.

  • color::ColorType=Makie.wong_colors()[2]: Color of the markers.

Returns

  • A tuple with the elements for the legend:

    • A MarkerElement to be used as the marker.
    • The label string.

References

F. Bigiel et al. (2010). EXTREMELY INEFFICIENT STAR FORMATION IN THE OUTER DISKS OF NEARBY GALAXIES. The Astrophysical Journal, 140(5), 1194. doi:10.1088/0004-6256/140/5/1194

source
GalaxyInspector.ppCross!Method
ppCross!(
    figure::Makie.Figure,
    cross_point::Tuple{<:Real,<:Real};
    <keyword arguments>
)::Nothing

Draw two lines, one horizontal and one vertical.

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.
  • cross_point::Tuple{<:Real,<:Real}: Crossing point of the lines.
  • color::ColorType=Makie.wong_colors()[6]: Color of the lines.
  • linestyle::LineStyleType=nothing: Style of the lines. nothing will produce a solid line.
source
GalaxyInspector.ppFeldmann2020!Method
ppFeldmann2020!(
    figure::Makie.Figure,
    x_quantity::Symbol,
    y_quantity::Symbol;
    <keyword arguments>
)::Tuple{Vector{<:LegendElement},Vector{AbstractString}}

Draw a line, or scatter, plot using the experimental data from the xGASS and xCOLD GASS collaborations, processed by Feldmann (2020).

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.

  • x_quantity::Symbol: Quantity for the x axis. The options are:

    • :stellar_mass -> Stellar mass.
    • :molecular_mass -> Molecular hydrogen ($\mathrm{H_2}$) mass.
    • :br_molecular_mass -> Molecular hydrogen ($\mathrm{H_2}$) mass, computed using the pressure relation in Blitz et al. (2006).
    • :atomic_mass -> Atomic hydrogen ($\mathrm{HI}$) mass.
    • :observational_sfr -> Star formation rate of the last AGE_RESOLUTION.
  • y_quantity::Symbol: Quantity for the y axis. The options are:

    • :stellar_mass -> Stellar mass.
    • :molecular_mass -> Molecular hydrogen ($\mathrm{H_2}$) mass.
    • :br_molecular_mass -> Molecular hydrogen ($\mathrm{H_2}$) mass, computed using the pressure relation in Blitz et al. (2006).
    • :atomic_mass -> Atomic hydrogen ($\mathrm{HI}$) mass.
    • :observational_sfr -> Star formation rate of the last AGE_RESOLUTION.
  • scatter::Bool=false: If the data will be presented as a line plot with error bands (default), or alternatively, a scatter plot.

Returns

  • A tuple with the elements for the legend:

    • A MarkerElement to be used as the marker.
    • The label string.

References

L. Blitz et al. (2006). The Role of Pressure in GMC Formation II: The H2-Pressure Relation. The Astrophysical Journal, 650(2), 933. doi:10.1086/505417

R. Feldmann (2020). The link between star formation and gas in nearby galaxies. Communications Physics 3(226). doi:10.1038/s42005-020-00493-0

source
GalaxyInspector.ppFillBelowLine!Method
ppFillBelowLine!(
    figure::Makie.Figure;
    <keyword arguments>
)::Nothing

Fill the space below a line plot, up to a lower_limit, with a solid color.

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.
  • lower_limit::Number=0.0: Lower bound.
  • color::ColorType=:red: Color.
  • alpha::Float64=0.3: Level of transparency. 1.0 is completely opaque and 0.0 is completely transparent.
source
GalaxyInspector.ppFitLine!Method
ppFitLine!(
    figure::Makie.Figure;
    <keyword arguments>
)::Union{Tuple{Vector{<:LegendElement},Vector{AbstractString}},Nothing}

Draw a linear fit for the data in figure.

An annotation with the equation $y = a \, x + b$, and the fitted values for $a$ and $b$, will be positioned in the upper right corner of the plot.

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.

  • text_position::Tuple{<:Real,<:Real}=(0.04, 0.98): Relative position of the legend box.

  • text_handle::Symbol=:left: Top corner of the legend box whose positions is set with text_position.

  • wts::Union{Vector{Float64},Nothing}=nothing: Weights for the fits. Set to nothing for a non-weighted fit.

  • error_formating::Symbol=:std_error: Error format for the annotation. The options are:

    • :std_error -> mean ± standard_error.
    • :conf_interval -> mean ± max(upper$_{95\%}$ - mean, mean - lower$_{95\%}$).
  • color::ColorType=Makie.wong_colors()[6]: Color of the line.

  • linestyle::LineStyleType=nothing: Style of the line. nothing will produce a solid line.

  • linewidth::Int=3: Line width.

Returns

  • A tuple with the elements for the legend:

    • A LineElement to be used as the marker.
    • The label string.
source
GalaxyInspector.ppHorizontalFlags!Method
ppHorizontalFlags!(
    figure::Makie.Figure,
    positions::Vector{<:Real};
    <keyword arguments>
)::Nothing

Draw horizontal lines.

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.
  • positions::Vector{<:Real}: The y coordinates of the lines.
  • colors::Vector{<:ColorType}=[:red]: Colors of the lines.
  • line_styles::Vector{<:LineStyleType}=[nothing]: Styles of the lines. nothing will produce a solid line.
source
GalaxyInspector.ppKennicutt1998!Method
ppKennicutt1998!(
    figure::Makie.Figure;
    <keyword arguments>
)::Union{Tuple{Vector{<:LegendElement},Vector{AbstractString}},Nothing}

Draw a line plot with the fit for the KS relation in Kennicutt (1998).

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.
  • x_unit::Unitful.Units=u"Msun * pc^-2": Unit for the area density of gas used in figure.
  • y_unit::Unitful.Units=u"Msun * yr^-1 * kpc^-2": Unit for the area density of star formation rate used in figure.
  • x_log::Bool=true: If the x axis is $\log_{10}(\Sigma_\mathrm{HI + H_2})$ (x_log = true) or just $\Sigma_\mathrm{HI + H_2}$ (x_log = false).
  • y_log::Bool=true: If the y axis is $\log_{10}(\Sigma_\mathrm{SFR})$ (y_log = true) or just $\Sigma_\mathrm{SFR}$ (y_log = false).
  • extend::Float64=0.0: By default the y axis limits of the line will be the vertical range of points in the plot. This can be extended by the fraction extend of the vertical range.
  • colors::Vector{<:ColorType}=[Makie.wong_colors()[6], Makie.wong_colors()[7]]: Colors for the line. The first color will indicate the range for which there are experimental data, and the second color will be for the extrapolation.
  • linestyle::LineStyleType=nothing: Style of the line. nothing will produce a solid line.
  • linewidth::Int=3: Line width.

Returns

  • A tuple with the elements for the legend:

    • A LineElement to be used as the marker.
    • The label string.

References

R. C. Kennicutt (1998). The Global Schmidt Law in Star-forming Galaxies. The Astrophysical Journal, 498(2), 541-552. doi:10.1086/305588

source
GalaxyInspector.ppMolla2015!Method
ppMolla2015!(
    figure::Makie.Figure,
    quantity::Symbol,
    <keyword arguments>
)::Tuple{Vector{<:LegendElement},Vector{AbstractString}}

Draw a profile for the Milky Way using the data compiled by Mollá et al. (2015).

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.

  • quantity::Symbol: Quantity for the y axis. The options are:

    • :stellar_area_density -> Stellar area mass density.
    • :molecular_area_density -> Molecular mass surface density.
    • :br_molecular_area_density -> Molecular mass surface density, computed using the pressure relation in Blitz et al. (2006).
    • :atomic_area_density -> Atomic hydrogen area mass density.
    • :sfr_area_density -> Star formation rate area density.
    • :X_stellar_abundance -> Stellar abundance of element $\mathrm{X}$, as $12 + \log_{10}(\mathrm{X \, / \, H})$. $\mathrm{X}$ can be O (oxygen), N (nitrogen), or C (carbon).
  • color::ColorType=Makie.wong_colors()[6]: Color of the line.

  • linestyle::LineStyleType=nothing: Style of the line. nothing will produce a solid line.

  • error_bars::Bool=true: If the error bars will be plotted.

Returns

  • A tuple with the elements for the legend:

    • A MarkerElement to be used as the marker.
    • The label string.

References

L. Blitz et al. (2006). The Role of Pressure in GMC Formation II: The H2-Pressure Relation. The Astrophysical Journal, 650(2), 933. doi:10.1086/505417

M. Mollá et al. (2015). Galactic chemical evolution: stellar yields and the initial mass function. Monthly Notices of the Royal Astronomical Society 451(4), 3693–3708. doi:10.1093/mnras/stv1102

source
GalaxyInspector.ppSun2023!Method
ppSun2023!(
    figure::Makie.Figure;
    <keyword arguments>
)::Tuple{Vector{<:LegendElement},Vector{AbstractString}}

Draw a scatter plot of the SFR surface density vs molecular surface density (molecular Kennicutt-Schmidt law) for a given galaxy, using the data of Sun et al. (2023).

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.

  • galaxy::Union{String,Symbol}=:main: Target galaxy. The options are:

    • One of the 80 galaxies in the dataset, e.g. "ESO097-013", "IC1954", "IC5273", "NGC1546", "NGC1559", "NGC1566", etc. For a full list see the reference below.
    • :main: Every galaxy with $-2.0 < \log_{10}(t_\mathrm{dep} \, / \, \mathrm{Gyr}) < 2.0$, where $t_\mathrm{dep} = \Sigma_\mathrm{H_2} / \Sigma_\mathrm{SFR}$ is the depletion time.
    • :all: All 80 galaxies in the dataset.

    For more information on each galaxy see Sun et al. (2023).

  • sfr_calibration::Symbol=:Halpha: SFR calibration for combining UV, optical, and/or IR data. The options are: :Halpha, :FUV, and :AV_corrected_Halpha. For an explanation of each one see section 2 of Sun et al. (2023).

  • h2_prescription::Symbol=:S20: Prescription for the CO-to-H₂ conversion factor. The options are: :S20, :Mw, :B13, and :G20. For an explanation of each one see section 2 of Sun et al. (2023).

  • x_log::Bool=true: If the x axis will be plotted as the log10 of the gas surface density.

  • y_log::Bool=true: If the y axis will be plotted as the log10 of the SFR surface density.

  • x_unit::Unitful.Units=u"Msun * pc^-2": Unit for the x axis.

  • y_unit::Unitful.Units=u"Msun * yr^-1 * kpc^-2": Unit for the y axis.

  • color::ColorType=Makie.wong_colors()[2]: Color of the markers.

Returns

  • A tuple with the elements for the legend:

    • A MarkerElement to be used as the marker.
    • The label string.

References

J. Sun et al. (2023). Star Formation Laws and Efficiencies across 80 Nearby Galaxies. The Astrophysical Journal Letters, 945(2), L19. doi:10.3847/2041-8213/acbd9c

source
GalaxyInspector.ppVerticalFlags!Method
ppVerticalFlags!(
    figure::Makie.Figure,
    positions::Vector{<:Real};
    <keyword arguments>
)::Nothing

Draw vertical lines.

Arguments

  • figure::Makie.Figure: Makie figure to be drawn over.
  • positions::Vector{<:Real}: The x coordinates of the lines.
  • colors::Vector{<:ColorType}=[:red]: Colors of the lines.
  • line_styles::Vector{<:LineStyleType}=[nothing]: Styles of the lines. nothing will produce a solid line.
source