Skip to main content

Crate map2fig

Crate map2fig 

Source
Expand description

§HEALPix Plotter

A Rust library for rendering HEALPix celestial maps in multiple projections (Mollweide, Hammer, Gnomonic).

§Overview

This library reads astronomical data from FITS files containing HEALPix sky maps and generates publication-quality visualizations in PDF and PNG formats. Key features include:

  • Multiple projections: Mollweide, Hammer, and Gnomonic
  • 80+ colormaps: matplotlib and custom colormaps
  • Data scaling: linear, logarithmic, symlog, asinh, and histogram equalization
  • HEALPix support: RING and NEST ordering, sparse and dense maps
  • Output formats: High-quality PDF via Cairo and PNG via image crate
  • Customization: full control over colors, scale, gamma, graticules, and more

§Quick Start

use map2fig::plot::plot_mollweide_auto;
use map2fig::params::MollweideParams;

let params = MollweideParams {
    fits_file: "map.fits".to_string(),
    output_file: "map.pdf".to_string(),
    ..Default::default()
};
plot_mollweide_auto(params);

§Main Plotting Functions

§Core Types

§Data Processing

Re-exports§

pub use cli::Args;
pub use cli::PlotConfig;
pub use colormap::Colormap;
pub use colormap::available_colormaps;
pub use colormap::get_colormap;
pub use fits::read_healpix_column;
pub use fits::read_healpix_column_cached;
pub use mask::PixelMask;
pub use pdf_optimize::PdfOptimizationConfig;
pub use pdf_optimize::estimate_pdf_complexity;
pub use plot::plot_gnomonic_auto;
pub use plot::plot_gnomonic_pdf;
pub use plot::plot_gnomonic_png;
pub use plot::plot_hammer_auto;
pub use plot::plot_hammer_pdf;
pub use plot::plot_hammer_png;
pub use plot::plot_mollweide_auto;
pub use plot::plot_mollweide_pdf;
pub use plot::plot_mollweide_png;
pub use scale::validate_scale_config;
pub use constants::*;

Modules§

benchmark
PDF Rendering Benchmarks and Performance Analysis
cli
cli_builder
CLI argument builder utilities for constructing plot parameters.
colorbar
colormap
constants
diagnostics
Performance diagnostics and profiling module.
executor
Plot execution module - handles projection selection and rendering.
fits
FITS file reading and data extraction.
gnomonic
gnomonic_graticule
Graticule rendering for gnomonic projections
graticule
hammer
healpix
HEALPix coordinate system and data sampling utilities.
latex
LaTeX-like text rendering for mathematical expressions
latex_render
layout
mask
mmap_reader
Memory-mapped FITS file reader
mollweide
params
Parameter bundling structs for plot functions.
pdf_optimize
pipeline
plot
projection
render
rotation
Coordinate rotations for astronomy.
scale
Data scaling and value normalization for visualization.
setup
Setup module - handles application initialization.
simd
SIMD vectorization module for high-performance batch operations.

Structs§

BatchedCairoImageSink
Batched Cairo pixel sink - groups pixels by color to reduce fill() calls.
CairoRasterSink
Sink for rendering pixels to a Cairo drawing context.
PngSink
Sink for rendering pixels directly to an in-memory PNG image buffer.
RgbaArg
RGBA color specified as comma-separated integers 0–255.

Enums§

NegMode
Strategy for handling negative, masked, or invalid pixel values in HEALPix maps.
PixelValue
Pixel value classification during data-to-color mapping.

Traits§

PixelSink
Trait for pixel rendering backends.

Functions§

generate_index_map
Generate a simple index map for testing.