imaging_plotter.figures_2d(image=True)
"""
__Plot Customization__

Does the figure display correctly on your computer screen? 

If not, you can customize a number of matplotlib setup options using a `MatPlot2D` object in **PyAutoLens**, which 
wraps the `matplotlib` methods used to display the image.

(For example, the `Figure` class wraps the `matplotlib` method `plt.figure(), whereas the `Yticks` class wraps
`plt.yticks`).
"""
mat_plot_2d = aplt.MatPlot2D(
    figure=aplt.Figure(figsize=(7, 7)),
    yticks=aplt.YTicks(fontsize=8),
    xticks=aplt.XTicks(fontsize=8),
    title=aplt.Title(fontsize=12),
    ylabel=aplt.YLabel(fontsize=6),
    xlabel=aplt.XLabel(fontsize=6),
)

imaging_plotter = aplt.ImagingPlotter(imaging=imaging, mat_plot_2d=mat_plot_2d)
imaging_plotter.figures_2d(image=True)
"""
Many matplotlib options can be customized, but for now we're only concerned with making sure figures display clear in 
your Jupyter Notebooks. Nevertheless, a comprehensive API reference guide of all `matplotlib` wrappers and methods can 
be found in the `autolens_workspace/plot` package. You should check this out once you are more familiar with 
**PyAutoLens**.

Ideally, we would not specify a new `MatPlot2D` object every time we plot an image, especially as you would be 
changing the same option to the same values every time (e.g. the figsize) to make the figure display correctly over 
Exemplo n.º 2
0
The benefit of inspecting fits using the aggregator, rather than the files outputs to the hard-disk, is that we can 
customize the plots using the PyAutoLens mat_plot_2d.

Below, we create a new function to apply as a generator to do this. However, we use a convenience method available 
in the PyAutoLens aggregator package to set up the fit.
"""
fit_agg = al.agg.FitImagingAgg(aggregator=agg)
fit_imaging_gen = fit_agg.max_log_likelihood_gen()

for fit in fit_imaging_gen:

    mat_plot_2d = aplt.MatPlot2D(
        figure=aplt.Figure(figsize=(12, 12)),
        title=aplt.Title(label="Custom Image", fontsize=24),
        yticks=aplt.YTicks(fontsize=24),
        xticks=aplt.XTicks(fontsize=24),
        cmap=aplt.Cmap(norm="log", vmax=1.0, vmin=1.0),
        colorbar_tickparams=aplt.ColorbarTickParams(labelsize=20),
        units=aplt.Units(in_kpc=True),
    )

    fit_imaging_plotter = aplt.FitImagingPlotter(fit=fit,
                                                 mat_plot_2d=mat_plot_2d)
    fit_imaging_plotter.figures_2d(normalized_residual_map=True)
"""
Making this plot for a paper? You can output it to hard disk.
"""
fit_agg = al.agg.FitImagingAgg(aggregator=agg)
fit_imaging_gen = fit_agg.max_log_likelihood_gen()

for fit in fit_imaging_gen:
Exemplo n.º 3
0
 https://matplotlib.org/3.3.2/api/_as_gen/matplotlib.pyplot.tick_params.html
 https://matplotlib.org/3.3.2/api/_as_gen/matplotlib.pyplot.yticks.html
 https://matplotlib.org/3.3.2/api/_as_gen/matplotlib.pyplot.xticks.html
"""
tickparams = aplt.TickParams(
    axis="y",
    which="major",
    direction="out",
    color="b",
    labelsize=20,
    labelcolor="r",
    length=2,
    pad=5,
    width=3,
    grid_alpha=0.8,
)

yticks = aplt.YTicks(alpha=0.8, fontsize=10, rotation="vertical")
xticks = aplt.XTicks(alpha=0.5, fontsize=5, rotation="horizontal")

mat_plot_2d = aplt.MatPlot2D(tickparams=tickparams,
                             yticks=yticks,
                             xticks=xticks)

array_plotter = aplt.Array2DPlotter(array=image, mat_plot_2d=mat_plot_2d)
array_plotter.figure_2d()
"""
Finish.
"""