# Plotting Histograms

Open the file `examples/cain/CaoPetzold2006_Schlogl.xml` and select the "Schlogl" model and the "Time Series" method. Select all of the species and reactions in the recorder panel and then generate 10 trajectories. The steady state distribution of species populations is bi-modal. In the plot of the trajectories below we can see that the trajectory paths separate into two groups.

We will study how the trajectories separate into a bi-modal distribution. Select the "Histograms Transient" method, which records the populations in histograms at 6 frames. Generate 10,000 trajectories and then click the plotting button in the simulation output panel to bring up the plot configuration window. In this window select the "Histograms" tab. At the top of the window see that the "Schlogl, Histograms Transient" output is selected. Next choose the "Multi-frame" option. (There is only a single species so you don't need to select the species to plot.) The plot configuration window is shown below.

Click the "Plot together" button to generate the plot shown below.

Note that the plot range is set to include the tall, thin histogram that shows the initial condition at t = 0. With this plot range we cannot distinguish the features of the other histograms. We can take a closer look at them by clicking the zoom button in the plotting window and selecting a rectangular area. Below is a closer look at the rest of the histograms.

We can exclude the histogram for the initial value by deselecting the "Show" field for the t = 0 row in the frame table of the plot configuration window. Next left click the "Line Color" column header to assign new hues to the remaining selected frames. Then left click the "Filled" and the "Fill Color" column headers to turn on filling and match the fill color to the line color. Right click the "Alpha" header until all of these values are reduced to 0.2. This will give us a faint fill color and allow us to see all of the lines. Finally, fill in the title and axes labels. The resulting plot configuration window is shown below.

Click the "Plot together" button to generate the figure shown below. We see that at t = 2 the trajectories have not yet separated into two groups. We can see the distribution become bi-modal as time advances. It appears the distribution is rapidly converging to the steady state, however this is not the case. In the subsequent sections we will see that determining the steady state solution requires some care.

Since the Schlogl problem is tricky, we will consider a simpler problem for introducing visualization of a steady state solution. Open the file `examples/cain/ImmigrationDeath.xml`. This problem is examined in the Immigration Death section of the Examples chapter. To determine the steady state distribution we will record the state in a time averaged histogram. First select "ImmigrationDeath10" from the model list, for which the initial population has been set to 10. Then select "SteadyState" from the list of methods. From the simulation parameters in the method editor you can see that the system is allowed to equilibrate for 100 seconds and then the state is recorded for 10,000 seconds. Generate 4 trajectories and then go to the plot configuration window. Clear the title and axes label from the previous example if necessary. The "Histograms" tab in this window is shown below.

Note that since this is an average value histogram, the "Multi-frame" option is disabled. The "Multi-species" option is selected, but there is no need to select a frame. Click the "Plot together" button to generate the figure shown below.

Let's customize the plot a bit. In the plot configuration window set the line color to black by right-clicking the column header. Increase the line width to 2 by left-clicking that column header. Specify that the region under the line should be filled, set the fill color to green by clicking on the color cell and set the alpha value to 0.5. Turn off the legend (there is a single species). Fill in the plot title and axes labels. Set the title color to blue and the axes label colors to red. The resulting plot configuration window and plot are shown below.