Note

This tutorial was generated from a Jupyter notebook that can be downloaded here.

Customize options

All tulips diagrams are customizable and contain many options that allow you to change the plots to your liking. These options are managed by a set of keywords that can be specified when calling a tulips function. In this notebook we mention the main possibilities.

Options available for all TULIPS diagrams

Changing the axis and label

The raxis property indicates what is represented by the radius of the circle. This is the quantity that is specified by the x and y axis labels. You can change the label of the x and y axis with the axis_label option.

Figure options

It is possible to plot tulips diagrams on already existing matplotlib fig and ax objects. This can be useful if you want to create subplots with multiple diagrams. You can pass these objects to the function with the fig and ax keywords. For an example, look at the Combining multiple static diagrams page. Moreover, you can choose the size of the figure with the fig_size option. You can set this parameter with a tuple containing the size in inches.

Time label

tulips diagrams show stellar models at a particular moment in time. By default, the age of the star at that moment is shown in the upper left corner of the plot in units of Myr. You can hide this time label by setting show_time_label to False. It is also possible to change the location of the time label with time_label_loc. You can specify the location using a tuple of values that represent fractions of the maximum X and Y axis values. We can move the time label to be in the upper right corner as follows:

[3]:
tulips.perceived_color(m11, time_ind=0, time_label_loc=(0.7,0.9))
plt.show()
_images/customize_5_0.svg

Time units

By default, the timelabel is shown in units of Myr. You can change this to another unit with the time_unit option. To convert the units, tulips makes use of astropy.units functionalities. Hence, the chosen unit should be a valid astropy unit. You can check this with import astropy.units as u and then press u.+Tab. This will reveal a lists with the valid units. For example, we can show the timelabel in year:

[4]:
tulips.perceived_color(m11,time_ind=0,time_unit='yr')
plt.show()
_images/customize_7_0.svg

Note

For information about the time_scale_type option, look at the Timestep options page.

Setting axis limits

It is possible to specify plot axis limits, to zoom in or out on the stellar model. In the following example, we see a circle corresponding to a stellar model whose radius represents the total mass of the star. By default, the (identical) X and Y axis limits are computed as 1.5 times the maximum of the raxis quantity. You can change axis_lim to specify a different upper limit for the X and Y axis. For example, if we set axis_lim=10, we are zooming in and only see the stellar model up to 10 \(M_{\odot}\).

[5]:
tulips.perceived_color(m11, time_ind=0, axis_lim=10, raxis='star_mass')
plt.show()
_images/customize_10_0.svg

Plotting wedges

Instead of plotting a full circle, you can also just plot one wedge. To do this, you can specify theta1 and theta2 as the start and end angle (in degrees) of the wedge. This is useful when you want to combine multiple diagrams in one plot (as at the Combining multiple static diagrams page). For example, we decide to plot only the first quarter as follows:

[6]:
tulips.perceived_color(m11, time_ind=-1, theta1=0, theta2=90)
plt.show()
_images/customize_12_0.svg

Hertzsprung-Russell diagram

All tulips diagrams show (by default) an inset Hertzsprung-Russell diagram in the lower left corner of the plot. A blue line shows the track that the stellar model will follow during its lifetime, and a yellow circle indicates where the model is located on this track at the current time index. To hide this inset HR diagram, set hrd_inset to False. You can also show labels on the axis (log:math:_{10}(T_{textrm{eff}}/textrm{K}) vs. log\(_{10}(L/L_{\odot})\)) of the HR diagram by setting show_hrd_ticks_and_labels to True.

Total mass label

By default, tulips shows the total mass of the stellar object (in \(M_{\odot}\)) in the bottom right corner. To hide this, you can set show_total_mass to False.

Show stellar surface

In a tulips diagram, the outer boundary of the star is shown by a black solid line. If you don’t want to show this line, set show_surface to False.

[7]:
tulips.perceived_color(m11, time_ind=0, show_surface=False)
plt.show()
_images/customize_14_0.svg

Output options

If you make an animation, it is automatically saved in a default filename in .mp4 format. However, you can change these settings. With the output_fname option, you can specify how you want to call the output file. Additionally, you can change the anim_fmt option to one of the other supported formats.

Colormap

For all tulips diagrams except the perceived color diagram, it is possible to specify the colormap with the cmap option. The colormap can be changed to any matplotlib colormap, but also to cmasher colormaps, which are color-vision deficiency friendly. In the following example we load the cmasher library and plot an energy_and_mixing diagram with another colormap:

[8]:
import cmasher as cmr
tulips.energy_and_mixing(m11, time_ind=2200, cmin=-10, cmax=10, show_total_mass=True,
                         cmap='cmr.rainforest')
plt.show()
_images/customize_17_0.svg

Options available for specific TULIPS diagrams

In addition to these general options, there are more possibilities specific for each tulips diagram. These are explained in the page of the corresponding diagram, which you can access via the navigation menu.