kascedollars.blogg.se

Mestrenova stacked spectra colors
Mestrenova stacked spectra colors







This is achieved through having multiple Y-axis, on different Axes objects, in the same position.įor example, the linear_sequence won't go above 20 on the Y-axis, while the exponential_sequence will go up to 20000. Plot Multiple Line Plots with Multiple Y-Axisįinally, we can apply the same scale (linear, logarithmic, etc), but have different values on the Y-axis of each line plot. We've also changed the tick label colors to match the color of the line plots themselves, otherwise, it'd be hard to distinguish which line is on which scale. One Axes has one scale, so we create a new one, in the same position as the first one, and set its scale to a logarithmic one, and plot the exponential sequence. This time around, we'll have to use the OOP interface, since we're creating a new Axes instance. # Plot exponential sequence, set scale to logarithmic and change tick colorĪx2.plot(exponential_sequence, color= 'green')Īx2.tick_params(axis= 'y', labelcolor= 'green') # Generate a new Axes instance, on the twin-X axes (same position) # Plot linear sequence, and set tick labels to the same colorĪx.tick_params(axis= 'y', labelcolor= 'red') Linear_sequence = Įxponential_sequence = np.exp(np.linspace( 0, 10, 10)) Let's change up the linear_sequence a bit to make it observable once we plot both: import matplotlib.pyplot as plt If we plot it on a logarithmic scale, and the linear_sequence just increases by the same constant, we'll have two overlapping lines and we will only be able to see the one plotted after the first. Now, let's plot the exponential_sequence on a logarithmic scale, which will produce a visually straight line, since the Y-scale will exponentially increase. The exponential growth in the exponential_sequence goes out of proportion very fast, and it looks like there's absolutely no difference in the linear_sequence, since it's so minuscule relative to the exponential trend of the other sequence.









Mestrenova stacked spectra colors