linefinder.analyze_data.plot_worldlines module¶
Tools for reading worldline data
@author: Zach Hafen @contact: zachary.h.hafen@gmail.com @status: Development
-
class
linefinder.analyze_data.plot_worldlines.
WorldlinesPlotter
(data_object, label=None, color='black')[source]¶ Bases:
galaxy_dive.plot_data.generic_plotter.GenericPlotter
-
export_to_firefly
(firefly_dir, install_firefly=False, firefly_source='https://github.com/ageller/Firefly.git', write_startup='append', pathlines=False, n_pathlines=100, snum=600, pathline_inds_to_display=None, center_time_on_snum=True, classifications=[None, 'is_hitherto_EP', 'is_hitherto_NEP', 'is_IP'], classification_ui_labels=['All', 'EP', 'NEP', 'IP'], tracked_properties=['logT', 'logZ', 'logDen', 'is_in_main_gal', 'is_in_other_gal', 'PType'], tracked_filter_flags=[True, True, True, True, True, True], tracked_colormap_flags=[True, True, True, True, True, True], size_mult=3, include_ruler=True, include_disk=True, use_default_colors=True, tracked_labels_mapping={}, dump_to_json=True)[source]¶ Export data to a Firefly visualization.
Parameters: - firefly_dir (str) – Directory that should contain the Firefly visualization.
- install_firefly (bool) – If True, clone Firefly.
- firefly_source (str) – Location of Firefly repository to clone from.
- write_startup (str or bool) –
The startup.json file controls what datasets you can select for Firefly to visualize at startup. Options:
True: Write the file, including overwriting. False: Don’t write the file. ‘append’: Append onto existing startup or write a new one. - pathlines (bool) – If True plot the pathlines for a subset of the data instead of instantaneous points.
- n_pathlines (int) – Number of pathlines to plot if pathlines is True.
- snum (int) – If not plotting pathlines plot the particle tracking data at this snapshot.
- pathline_inds_to_display (list) – If plotting pathlines and this is not None, the pathlines will extend according to the inds given in this list.
- center_time_on_snum (bool) – If True any displayed time is relative to the snapshot given in snum.
- classifications (list of strs) – What classifications to display on Firefly. Defaults to no classification, but any that are part of the analysis package are available to use.
- classification_ui_labels (list of strs) – For each classification how you want it to show up on the UI.
- tracked_properties (list of strs) – What properties you want to display colormaps of or filter on.
- tracked_filter_flags (list of bools) – Which of the tracked_properties you want to filter on.
- tracked_colormap_flags (list of bools) – Which of the tracked_properties you want to show colormaps of.
- size_mult (float) – Size of particles (in no particular units, though larger is bigger).
- include_ruler (bool) – If True display a 100x100x100 ruler centered at (0,0,0) with 1 kpc spacing between points.
- include_disk (bool) – If True display a 50 kpc line starting at the galaxy center and eclassificationxtending out 50 kpc parallel to the total angular momentum of the stars in the galaxy. In addition draw a circle perpendicular to the total angular momentum and with a radius of R_gal.
- use_default_colors (bool) – If True, colors used for different classifications come from config.COLORSCHEME
- dump_to_json (bool) – If True, save the data output in the Firefly directory.
-
histogram
(data_key, provided_data=None, provided_hist=None, weight_key=None, slices=None, ax=None, fix_invalid=False, mask_zeros=False, invalid_fix_method=None, bins=32, normed=True, norm_type='probability', scaling=None, smooth=False, smoothing_window_length=9, smoothing_polyorder=3, histogram_style='step', color='black', linestyle='-', linewidth=3.5, alpha=1.0, x_range=None, y_range=None, x_label=None, y_label=None, add_x_label=True, add_y_label=True, add_plot_label=True, plot_label=None, line_label=None, label_fontsize=24, x_scale='linear', y_scale='linear', cdf=False, vertical_line=None, vertical_line_kwargs={'color': 'k', 'linestyle': '--', 'linewidth': 3}, return_dist=False, assert_contains_all_data=True, data_kwargs={}, *args, **kwargs)¶ Make a histogram of the data. Extra arguments are passed to self.data_object.get_selected_data.
Parameters: - data_key (str) – Data key to plot.
- weight_key (str) – Data key for data to use as a weight. By None, no weight.
- slices (int or tuple of slices) – How to slices the data.
- ax (axis) – What axis to use. By default creates a figure and places the axis on it.
- fix_invalid (bool) – Throw away invalid values?
- invalid_fix_method (float or int) – How to handle invalid values. By None throw them away. Providing a value to this argument instead replaces them with that value.
- bins (int or array-like) – bins argument to be passed to np.histogram
- normed (bool) – Normalize the histogram?
- color (str) – Color of histogram.
- linestyle (str) – Linestyle of histogram.
- linewidth (float) – Linewidth for histogram.
- alpha (float) – Alpha value for histogram
- y_range (x_range,) – What are the minimum and maximum x- and y- values to include? Defaults to matplotlib’s automatic choices
- ylabel (x_label,) – Axes labels. Defaults to the data_key for the x-axis and “Normalized Histogram” for the y-axis.
- add_y_label (add_x_label,) – Include axes labels?
- plot_label (str or dict) – What to label the plot with. By None, uses self.label.
- line_label (str) – What label to give the line.
- label_fontsize (int) – Fontsize for the labels.
- y_scale (x_scale,) – What scales to use for the x and y axes.
- cdf (bool) – Plot a CDF instead.
- vertical_line (float) – Plot a vertical line at this value on the x-axis, if true.
- vertical_line_kwargs (dict) – Arguments to pass to ax.plot( for the vertical line.
- return_dist (bool) – If True, return the data values and the edges for the histogram.
- assert_contains_all_data (bool) – If True, make sure that the histogram plots all selected data.
- **kwargs (*args,) –
Extra arguments to pass to self.data_object.get_selected_data()
-
histogram2d
(x_key, y_key, x_data=None, y_data=None, weight_key=None, x_data_args={}, y_data_args={}, weight_data_args={}, slices=None, ax=None, x_range=None, y_range=None, x_scale='linear', y_scale='linear', z_scale='log', n_bins=128, average=False, normed=False, hist_div_arr=None, conditional_y=False, y_div_function=None, vmin=None, vmax=None, min_bin_value_displayed=None, zorder=0, add_colorbar=True, cmap=<matplotlib.colors.ListedColormap object>, colorbar_args=None, x_label=None, y_label=None, add_x_label=True, add_y_label=True, plot_label=None, outline_plot_label=False, label_galaxy_cut=False, label_redshift=False, label_fontsize=24, tick_param_args=None, out_dir=None, save_file=None, close_plot_after_saving=True, fix_invalid=True, line_slope=None, cdf=False, horizontal_line=None, vertical_line=None, horizontal_line_kwargs={'color': '#337DB8', 'linestyle': '--', 'linewidth': 5}, vertical_line_kwargs={'color': '#337DB8', 'linestyle': '--', 'linewidth': 5}, return_dist=False, *args, **kwargs)¶ Make a 2D histogram of the data. Extra arguments are passed to get_selected_data.
Parameters: - y_key (x_key,) – Data keys to plot.
- weight_key (str) – Data key for data to use as a weight. By None, no weight.
- y_data_args (x_data_args,) – Keyword arguments to be passed only to x or y.
- slices (int or tuple of slices) – How to slices the data.
- ax (axis) – What axis to use. By None creates a figure and places the axis on it.
- y_range (x_range,) – Histogram edges. If None, all data is enclosed. If list, set manually. If float, is +- x_range*length scale at that snapshot.
- n_bins (int) – Number of bins in the histogram.
- vmax (vmin,) – Limits for the colorbar.
- aspect (str) – What should the aspect ratio of the plot be?
- plot_halos (bool) – Whether or not to plot merger tree halos on top of the histogram. Only makes sense for when dealing with positions.
- add_colorbar (bool) – If True, add a colorbar to colorbar_args
- colorbar_args (axis) – What axis to add the colorbar to. By None, is ax.
- ylabel (x_label,) – Axes labels.
- add_y_label (add_x_label,) – Include axes labels?
- plot_label (str or dict) – What to label the plot with. By None, uses self.label. Can also pass a dict of full args.
- outline_plot_label (bool) – If True, add an outline around the plot label.
- label_galaxy_cut (bool) – If true, add a label that indicates how the galaxy was defined.
- label_redshift (bool) – If True, add a label indicating the redshift.
- label_fontsize (int) – Fontsize for the labels.
- tick_param_args (args) – Arguments to pass to ax.tick_params. By None, don’t change inherent defaults.
- out_dir (str) – If given, where to save the file.
- fix_invalid (bool) – Fix invalid values.
- line_slope (float) – If given, draw a line with the given slope.
-
make_multiple_plots
(plotting_method_str, iter_args_key, iter_args, n_processors=1, out_dir=None, make_out_dir_subdir=True, make_movie=False, clear_data=False, *args, **kwargs)¶ Make multiple plots of a selected type. *args and **kwargs are passed to plotting_method_str.
Parameters: - plotting_method_str (str) – What plotting method to use.
- iter_args_key (str) – The name of the argument to iterate over.
- iter_args (list) – List of argument values to change.
- n_processors (int) – Number of processors to use. Should only be used when saving the data.
- out_dir (str) – Where to save the data.
- make_movie (bool) – Make a movie out of the plots, if True.
- clear_data (bool) – If True, clear memory of the data after making the plots.
-
panel_plot
(panel_plotting_method_str, defaults, variations, slices=None, n_rows=2, n_columns=2, plot_locations=[(0, 0), (0, 1), (1, 0), (1, 1)], figsize=(10, 9), plot_label=None, outline_plot_label=False, label_galaxy_cut=False, label_redshift=True, label_fontsize=24, subplot_label_args={'color': 'k', 'fontsize': 20, 'xy': (0.075, 0.88), 'xycoords': 'axes fraction'}, subplot_spacing_args={'hspace': 0.0001, 'wspace': 0.0001}, out_dir=None)¶ Make a multi panel plot of the type of your choosing.
Parameters: - panel_plotting_method_str (str) – What type of plot to make.
- defaults (dict) – Default arguments to pass to panel_plotting_method.
- variations (dict of dicts) – Differences in plotting arguments per subplot.
- slices (slice) – What slices to select. By None, this doesn’t pass any slices argument to panel_plotting_method
- plot_label (str or dict) – What to label the plot with. By None, uses self.label. Can also pass a dict of full args.
- outline_plot_label (bool) – If True, add an outline around the plot label.
- label_galaxy_cut (bool) – If true, add a label that indicates how the galaxy was defined.
- label_redshift (bool) – If True, add a label indicating the redshift.
- label_fontsize (int) – Fontsize for the labels.
- subplot_label_args (dict) – Label arguments to pass to each subplot for the label for the subplot. The actual label string itself corresponds to the keys in variations.
- subplot_spacing_args (dict) – How to space the subplots.
- out_dir (str) – If given, where to save the file.
-
plot_classification_bar
(x_pos, classification_list=['is_fresh_accretion', 'is_NEP_wind_recycling', 'is_mass_transfer', 'is_merger_gas', 'is_merger_star'], classification_colors={'all': 'black', None: 'black', 'is_in_CGM': 'black', 'is_CGM_IGM_accretion': array([0.196, 0.532, 0.7 ]), 'is_CGM_NEP': array([0.196, 0.532, 0.7 ]), 'is_hitherto_NEP': array([0.196, 0.532, 0.7 ]), 'is_CGM_wind': array([0.224, 0.8 , 0.416]), 'is_CGM_IP': array([0.224, 0.8 , 0.416]), 'is_outside_any_gal_IP': array([0.224, 0.8 , 0.416]), 'is_CGM_satellite_wind': array([0.7 , 0.46984, 0.196 ]), 'is_CGM_EP': array([0.7 , 0.46984, 0.196 ]), 'is_hitherto_EP': array([0.7 , 0.46984, 0.196 ]), 'is_outside_any_gal_EP': array([0.7 , 0.46984, 0.196 ]), 'is_CGM_satellite_ISM': array([0.5 , 0.16266667, 0.1 ]), 'is_CGM_satellite': array([0.5 , 0.16266667, 0.1 ]), 'is_in_galaxy_halo_interface': array([0.8 , 0.32 , 0.784]), 'is_pristine': [0.0, 0.47843137254901963, 0.6862745098039216], 'is_NEP_NYA': [0.0, 0.47843137254901963, 0.6862745098039216], 'is_fresh_accretion': [0.0392156862745098, 0.29411764705882354, 0.7764705882352941], 'is_NEP_wind_recycling': [0.027450980392156862, 0.7372549019607844, 0.43137254901960786], 'is_IP': [0.2980392156862745, 0.6862745098039216, 0.0], 'is_wind': [0.2980392156862745, 0.6862745098039216, 0.0], 'is_preprocessed': [0.984313725490196, 0.5764705882352941, 0.09803921568627451], 'is_mass_transfer': [0.9921568627450981, 0.8274509803921568, 0.050980392156862744], 'is_mass_transfer_NYA': [0.9921568627450981, 0.8274509803921568, 0.050980392156862744], 'is_merger': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_NYA': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_star': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_gas': [0.9019607843137255, 0.4666666666666667, 0.06666666666666667], 'is_CGM_accreted': (0.5333333333333333, 0.8, 0.9333333333333333), 'is_CGM_ejected': (0.8, 0.4, 0.4666666666666667), 'is_CGM_still': (0.8666666666666667, 0.8, 0.4666666666666667), 'is_CGM_accreted_to_satellite': (0.2, 0.13333333333333333, 0.5333333333333333), 'is_CGM_halo_transfer': (0.6666666666666666, 0.26666666666666666, 0.6), 'is_CGM_fate_unclassified': (0.06666666666666667, 0.4666666666666667, 0.2), 'will_leaves_gal_dt_0.050': (0.8980392156862745, 0.5254901960784314, 0.023529411764705882), 'is_cluster_star': (0.36470588235294116, 0.4117647058823529, 0.6941176470588235)}, ind=0, ax=None, width=0.5, add_label=False, alpha=1.0, *args, **kwargs)[source]¶ Make a bar plotting the classifications.
-
plot_classification_values
(values='mass_fractions', ax=None, label=None, y_label=None, y_scale=None, color=None, pointsize=3000, y_range=None)[source]¶ Plot overall values from a classification category.
Parameters:
-
plot_classified_time_dependent_data
(ax=None, x_data='get_redshift', y_datas='get_categories_selected_quantity', x_range=[0.0, 0.9030899869919435], y_range=None, y_scale='log', x_label=None, y_label=None, classification_list=['is_fresh_accretion', 'is_NEP_wind_recycling', 'is_mass_transfer', 'is_merger_gas', 'is_merger_star'], classification_colors={'all': 'black', None: 'black', 'is_in_CGM': 'black', 'is_CGM_IGM_accretion': array([0.196, 0.532, 0.7 ]), 'is_CGM_NEP': array([0.196, 0.532, 0.7 ]), 'is_hitherto_NEP': array([0.196, 0.532, 0.7 ]), 'is_CGM_wind': array([0.224, 0.8 , 0.416]), 'is_CGM_IP': array([0.224, 0.8 , 0.416]), 'is_outside_any_gal_IP': array([0.224, 0.8 , 0.416]), 'is_CGM_satellite_wind': array([0.7 , 0.46984, 0.196 ]), 'is_CGM_EP': array([0.7 , 0.46984, 0.196 ]), 'is_hitherto_EP': array([0.7 , 0.46984, 0.196 ]), 'is_outside_any_gal_EP': array([0.7 , 0.46984, 0.196 ]), 'is_CGM_satellite_ISM': array([0.5 , 0.16266667, 0.1 ]), 'is_CGM_satellite': array([0.5 , 0.16266667, 0.1 ]), 'is_in_galaxy_halo_interface': array([0.8 , 0.32 , 0.784]), 'is_pristine': [0.0, 0.47843137254901963, 0.6862745098039216], 'is_NEP_NYA': [0.0, 0.47843137254901963, 0.6862745098039216], 'is_fresh_accretion': [0.0392156862745098, 0.29411764705882354, 0.7764705882352941], 'is_NEP_wind_recycling': [0.027450980392156862, 0.7372549019607844, 0.43137254901960786], 'is_IP': [0.2980392156862745, 0.6862745098039216, 0.0], 'is_wind': [0.2980392156862745, 0.6862745098039216, 0.0], 'is_preprocessed': [0.984313725490196, 0.5764705882352941, 0.09803921568627451], 'is_mass_transfer': [0.9921568627450981, 0.8274509803921568, 0.050980392156862744], 'is_mass_transfer_NYA': [0.9921568627450981, 0.8274509803921568, 0.050980392156862744], 'is_merger': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_NYA': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_star': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_gas': [0.9019607843137255, 0.4666666666666667, 0.06666666666666667], 'is_CGM_accreted': (0.5333333333333333, 0.8, 0.9333333333333333), 'is_CGM_ejected': (0.8, 0.4, 0.4666666666666667), 'is_CGM_still': (0.8666666666666667, 0.8, 0.4666666666666667), 'is_CGM_accreted_to_satellite': (0.2, 0.13333333333333333, 0.5333333333333333), 'is_CGM_halo_transfer': (0.6666666666666666, 0.26666666666666666, 0.6), 'is_CGM_fate_unclassified': (0.06666666666666667, 0.4666666666666667, 0.2), 'will_leaves_gal_dt_0.050': (0.8980392156862745, 0.5254901960784314, 0.023529411764705882), 'is_cluster_star': (0.36470588235294116, 0.4117647058823529, 0.6941176470588235)}, *args, **kwargs)[source]¶ Make a plot like the top panel of Fig. 3 in Angles-Alcazar+17
Parameters: - ax (axis object) – What axis to put the plot on. By default, create a new one on a separate figure.
- y_range (x_range,) – [ x_min, x_max ] or [ y_min, y_max ] for the displayed range.
- y_label (x_label,) – Labels for axis. By default, redshift and f(M_star), respectively.
- plot_dividing_line (bool) – Whether or not to plot a line at the edge between stacked regions.
- **kwargs (*args,) –
Passed to the data retrieval method.
-
plot_stacked_data
(x_key, y_keys, colors, ax=None, *args, **kwargs)¶
-
plot_stacked_radial_data
(radial_bins, ax=None, x_range=None, y_range=[0.0, 1.0], x_label=None, y_label=None, plot_dividing_line=False, classification_list=['is_fresh_accretion', 'is_NEP_wind_recycling', 'is_mass_transfer', 'is_merger_gas', 'is_merger_star'], classification_colors={'all': 'black', None: 'black', 'is_in_CGM': 'black', 'is_CGM_IGM_accretion': array([0.196, 0.532, 0.7 ]), 'is_CGM_NEP': array([0.196, 0.532, 0.7 ]), 'is_hitherto_NEP': array([0.196, 0.532, 0.7 ]), 'is_CGM_wind': array([0.224, 0.8 , 0.416]), 'is_CGM_IP': array([0.224, 0.8 , 0.416]), 'is_outside_any_gal_IP': array([0.224, 0.8 , 0.416]), 'is_CGM_satellite_wind': array([0.7 , 0.46984, 0.196 ]), 'is_CGM_EP': array([0.7 , 0.46984, 0.196 ]), 'is_hitherto_EP': array([0.7 , 0.46984, 0.196 ]), 'is_outside_any_gal_EP': array([0.7 , 0.46984, 0.196 ]), 'is_CGM_satellite_ISM': array([0.5 , 0.16266667, 0.1 ]), 'is_CGM_satellite': array([0.5 , 0.16266667, 0.1 ]), 'is_in_galaxy_halo_interface': array([0.8 , 0.32 , 0.784]), 'is_pristine': [0.0, 0.47843137254901963, 0.6862745098039216], 'is_NEP_NYA': [0.0, 0.47843137254901963, 0.6862745098039216], 'is_fresh_accretion': [0.0392156862745098, 0.29411764705882354, 0.7764705882352941], 'is_NEP_wind_recycling': [0.027450980392156862, 0.7372549019607844, 0.43137254901960786], 'is_IP': [0.2980392156862745, 0.6862745098039216, 0.0], 'is_wind': [0.2980392156862745, 0.6862745098039216, 0.0], 'is_preprocessed': [0.984313725490196, 0.5764705882352941, 0.09803921568627451], 'is_mass_transfer': [0.9921568627450981, 0.8274509803921568, 0.050980392156862744], 'is_mass_transfer_NYA': [0.9921568627450981, 0.8274509803921568, 0.050980392156862744], 'is_merger': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_NYA': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_star': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_gas': [0.9019607843137255, 0.4666666666666667, 0.06666666666666667], 'is_CGM_accreted': (0.5333333333333333, 0.8, 0.9333333333333333), 'is_CGM_ejected': (0.8, 0.4, 0.4666666666666667), 'is_CGM_still': (0.8666666666666667, 0.8, 0.4666666666666667), 'is_CGM_accreted_to_satellite': (0.2, 0.13333333333333333, 0.5333333333333333), 'is_CGM_halo_transfer': (0.6666666666666666, 0.26666666666666666, 0.6), 'is_CGM_fate_unclassified': (0.06666666666666667, 0.4666666666666667, 0.2), 'will_leaves_gal_dt_0.050': (0.8980392156862745, 0.5254901960784314, 0.023529411764705882), 'is_cluster_star': (0.36470588235294116, 0.4117647058823529, 0.6941176470588235)}, *args, **kwargs)[source]¶ Parameters: - ax (axis object) – What axis to put the plot on. By default, create a new one on a separate figure.
- y_range (x_range,) – [ x_min, x_max ] or [ y_min, y_max ] for the displayed range.
- y_label (x_label,) – Labels for axis. By default, redshift and f(M_star), respectively.
- plot_dividing_line (bool) – Whether or not to plot a line at the edge between stacked regions.
-
plot_stacked_time_dependent_data
(ax=None, x_data='get_redshift', y_datas='get_categories_selected_quantity', x_range=[0.0, 0.9030899869919435], y_range=[0.0, 1.0], tick_redshifts=array([0.25, 0.5 , 1. , 2. , 3. , 4. , 5. , 6. , 7. ]), time_x_axis=False, twin_redshift=False, x_label=None, y_label=None, plot_dividing_line=False, classification_list=['is_fresh_accretion', 'is_NEP_wind_recycling', 'is_mass_transfer', 'is_merger_gas', 'is_merger_star'], classification_colors={'all': 'black', None: 'black', 'is_in_CGM': 'black', 'is_CGM_IGM_accretion': array([0.196, 0.532, 0.7 ]), 'is_CGM_NEP': array([0.196, 0.532, 0.7 ]), 'is_hitherto_NEP': array([0.196, 0.532, 0.7 ]), 'is_CGM_wind': array([0.224, 0.8 , 0.416]), 'is_CGM_IP': array([0.224, 0.8 , 0.416]), 'is_outside_any_gal_IP': array([0.224, 0.8 , 0.416]), 'is_CGM_satellite_wind': array([0.7 , 0.46984, 0.196 ]), 'is_CGM_EP': array([0.7 , 0.46984, 0.196 ]), 'is_hitherto_EP': array([0.7 , 0.46984, 0.196 ]), 'is_outside_any_gal_EP': array([0.7 , 0.46984, 0.196 ]), 'is_CGM_satellite_ISM': array([0.5 , 0.16266667, 0.1 ]), 'is_CGM_satellite': array([0.5 , 0.16266667, 0.1 ]), 'is_in_galaxy_halo_interface': array([0.8 , 0.32 , 0.784]), 'is_pristine': [0.0, 0.47843137254901963, 0.6862745098039216], 'is_NEP_NYA': [0.0, 0.47843137254901963, 0.6862745098039216], 'is_fresh_accretion': [0.0392156862745098, 0.29411764705882354, 0.7764705882352941], 'is_NEP_wind_recycling': [0.027450980392156862, 0.7372549019607844, 0.43137254901960786], 'is_IP': [0.2980392156862745, 0.6862745098039216, 0.0], 'is_wind': [0.2980392156862745, 0.6862745098039216, 0.0], 'is_preprocessed': [0.984313725490196, 0.5764705882352941, 0.09803921568627451], 'is_mass_transfer': [0.9921568627450981, 0.8274509803921568, 0.050980392156862744], 'is_mass_transfer_NYA': [0.9921568627450981, 0.8274509803921568, 0.050980392156862744], 'is_merger': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_NYA': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_star': [0.8901960784313725, 0.1843137254901961, 0.054901960784313725], 'is_merger_gas': [0.9019607843137255, 0.4666666666666667, 0.06666666666666667], 'is_CGM_accreted': (0.5333333333333333, 0.8, 0.9333333333333333), 'is_CGM_ejected': (0.8, 0.4, 0.4666666666666667), 'is_CGM_still': (0.8666666666666667, 0.8, 0.4666666666666667), 'is_CGM_accreted_to_satellite': (0.2, 0.13333333333333333, 0.5333333333333333), 'is_CGM_halo_transfer': (0.6666666666666666, 0.26666666666666666, 0.6), 'is_CGM_fate_unclassified': (0.06666666666666667, 0.4666666666666667, 0.2), 'will_leaves_gal_dt_0.050': (0.8980392156862745, 0.5254901960784314, 0.023529411764705882), 'is_cluster_star': (0.36470588235294116, 0.4117647058823529, 0.6941176470588235)}, label=None, show_label=True, label_kwargs={'fontsize': 22, 'xy': (0.0, 1.0225), 'xycoords': 'axes fraction'}, add_legend=True, hubble=None, omega_matter=None, legend_kwargs={'bbox_to_anchor': (0.5, -0.3), 'loc': 'center', 'ncol': 3}, *args, **kwargs)[source]¶ Make a plot like the bottom panel of Fig. 3 in Angles-Alcazar+17
Parameters: - ax (axis object) – What axis to put the plot on. By default, create a new one on a separate figure.
- y_range (x_range,) – [ x_min, x_max ] or [ y_min, y_max ] for the displayed range.
- y_label (x_label,) – Labels for axis. By default, redshift and f(M_star), respectively.
- plot_dividing_line (bool) – Whether or not to plot a line at the edge between stacked regions.
-
plot_streamlines
(x_key='Rx', y_key='Ry', x_data_kwargs={}, y_data_kwargs={}, classification=None, classification_ind=0, sample_selected_interval=True, selected_interval_type='time_as', selected_interval_classification=None, t_show_min=0.5, t_show_max=1.0, start_ind=0, end_ind='time_based', t_start=None, t_end=None, sample_inds=None, sample_size=10, convert_x_to_comoving=False, convert_y_to_comoving=False, ax=None, x_range=None, y_range=None, x_scale='linear', y_scale='linear', color=None, zorder=100.0, linewidth=1.5, fade_streamlines=True, line_features=None, x_label='x position (pkpc)', y_label='y position (pkpc)', plot_xlabel=True, plot_ylabel=True, fontsize=22, xkcd_mode=False, plot_halos=True, halo_radius_fraction=None, halo_length_scale=None, verbose=False, return_y_max=False, *args, **kwargs)[source]¶ Plot streamlines. This code largely follows what Daniel did before, at least in ideas.
-
plot_streamlines_vs_time
(x_key='time', y_key='R', classification_ind=0, vert_line_at_classification_ind=True, sample_selected_interval=False, horizontal_line_value=None, ax=None, fade_streamlines=False, x_label='Age of the Universe (Gyr)', y_label='Radial Distance (pkpc)', plot_halos=False, halo_y_key='Yc', halo_plot_kwargs={'n_halos': 100}, plot_CGM_region=False, CGM_region_alpha=0.2, return_y_max=False, *args, **kwargs)[source]¶
-
plot_time_dependent_data
(ax=None, x_range=[0.0, 0.9030899869919435], y_range=None, y_scale='log', x_label=None, y_label=None)¶ Make a plot like the top panel of Fig. 3 in Angles-Alcazar+17
Parameters: - ax (axis object) – What axis to put the plot on. By None, create a new one on a separate figure.
- y_range (x_range,) – [ x_min, x_max ] or [ y_min, y_max ] for the displayed range.
- y_label (x_label,) – Labels for axis. By None, redshift and f(M_star), respectively.
- plot_dividing_line (bool) – Whether or not to plot a line at the edge between stacked regions.
-
plot_with_halos
(plot_with_halos_method='histogram2d', slices=None, ax=None, out_dir=None, halo_color='#337DB8', halo_linewidth=3, halo_outline=False, radius_fractions=None, n_halos_plotted=100, show_valid_halos=True, *args, **kwargs)[source]¶ Plot with halos overlayed on top.
-
same_axis_plot
(axis_plotting_method_str, variations, ax=None, figsize=(11, 5), out_dir=None, add_line_label=False, legend_args={'fontsize': 20, 'loc': 'upper right', 'prop': {'size': 16.5}}, *args, **kwargs)¶
-
scatter
(x_key, y_key, slices=None, n_subsample=None, ax=None, marker_size=100, color='k', marker='.', zorder=-100, x_range=None, y_range=None, x_label=None, y_label=None, add_x_label=True, add_y_label=True, plot_label=None, outline_plot_label=False, label_galaxy_cut=False, label_redshift=False, label_fontsize=24, tick_param_args=None, out_dir=None, fix_invalid=True, line_slope=None, *args, **kwargs)¶ Make a 2D scatter plot of the data. Extra arguments are passed to get_selected_data. :param x_key, y_key: Data keys to plot. :type x_key, y_key: str :param weight_key: Data key for data to use as a weight. By None, no weight. :type weight_key: str :param slices: How to slices the data. :type slices: int or tuple of slices :param ax: What axis to use. By None creates a figure and places the axis on it. :type ax: axis :param x_range, y_range: Histogram edges. If None, all data is enclosed. If list, set manually.
If float, is +- x_range*length scale at that snapshot.Parameters: - n_bins (int) – Number of bins in the histogram.
- vmax (vmin,) – Limits for the colorbar.
- plot_halos (bool) – Whether or not to plot merger tree halos on top of the histogram. Only makes sense for when dealing with positions.
- add_colorbar (bool) – If True, add a colorbar to colorbar_args
- colorbar_args (axis) – What axis to add the colorbar to. By None, is ax.
- ylabel (x_label,) – Axes labels.
- add_y_label (add_x_label,) – Include axes labels?
- plot_label (str or dict) – What to label the plot with. By None, uses self.label. Can also pass a dict of full args.
- outline_plot_label (bool) – If True, add an outline around the plot label.
- label_galaxy_cut (bool) – If true, add a label that indicates how the galaxy was defined.
- label_redshift (bool) – If True, add a label indicating the redshift.
- label_fontsize (int) – Fontsize for the labels.
- tick_param_args (args) – Arguments to pass to ax.tick_params. By None, don’t change inherent defaults.
- out_dir (str) – If given, where to save the file.
- fix_invalid (bool) – Fix invalid values.
- line_slope (float) – If given, draw a line with the given slope.
-
statistic_and_interval
(x_key, y_key, x_data=None, y_data=None, weights=None, statistic='median', lower_percentile=16, upper_percentile=84, plot_interval=True, x_data_args={}, y_data_args={}, ax=None, slices=None, fix_invalid=False, bins=64, linewidth=3, linestyle='-', color='k', label=None, zorder=100, alpha=0.5, plot_label=None, add_plot_label=True, plot_label_kwargs={'fontsize': 22, 'va': 'bottom', 'xy': (0.0, 1.0), 'xycoords': 'axes fraction'}, return_values=False, *args, **kwargs)¶
-