Showing posts with label Label. Show all posts
Showing posts with label Label. Show all posts

Plot 12-bit tiff image with log scale colorbar using python & matplotlib.pyplot


The result is:

Show 12-bit tiff image with log scale colorbar using python & matplotlib.pyplot

Some of the output data from measuring equipment have 12-bit unsigned int data. In some case, tiff format is used to ensure the convenience of the users. Reading the 12-bit tiff file and plotting the 12-bit tiff file is very easy. In addition, you can increase the visibility of the output figure by using log scale colormap when you plotting the tiff file. This page shows how to plot 12-bit tiff file in log scale using python and matplotlib.pyplot. 2D gaussian distribution is used as an example data.

Draw two axis to one colorbar using python and matplotlib.pyplot


The result is:

Draw two axis to one colorbar using python and matplotlib.pyplot

In my post in 14th, Oct. 2018, I showed how to draw second tick axis on the colorbar. The method of plotting is not so good, so I'd like to show an improved way to draw second tick axis on the colorbar. This page shows how to draw two axis to one colorbar using python and matplotlib.pyplot. By adapting twinx to the colorbar axis and by shifting the position of labels and ticks, you can draw an figure like the example on this page.

Combine three 2D colorap in one figure using Python and Matplotlib.pyplot


The result is:
If you want to plot three 2D colormaps on one figure, the only feasible way is combining these three colormaps to one image. This can be achieved by corresponding three values to three primary elements, i.e. red, green, blue. However, interpretation of the completed figure is quite complex, and easiness of understanding for readers would be decreased. In my opinion, this way for plotting should be avoided.

If you want to plot three 2D colormaps on one figure, the only feasible way is combining these three colormaps to one image. This can be achieved by corresponding three values to three primary elements, i.e. red, green, blue. However, interpretation of the completed figure is quite complex, and easiness of understanding for readers would be decreased. In my opinion, this way for plotting should be avoided.


Convert x value to symlog scale with zero shift using Python and matplotlib.pyplot


The result is:

Convert x value to symlog scale with zero shift using Python and matplotlib.pyplot

This code shows how to convert x value to symlog scale with zero shift using Python and matplotlib.pyplot

Two ways to align ylabels for two plots using Python and matplotlib.pyplot


The result is:

Two ways to align ylabels for two plots using Python and matplotlib.pyplot

This page shows two ways to align two ylabels for two subplots using Python and matplotlib.pyplot.

Combine two contourf and one colorbar into one figure using Python and matplotlib.pyplot


The result is:
Combine two contourf and one colorbar into one figure using Python and matplotlib.pyplot

This page shows how to combine two contourf and one colorbar into one figure using python and matplotlib.pyplot.

Plot contour figure from data which has large scale and plus-minus difference with minimum limit using Python and matplotlib.pyplot


The result is:

Plot contour figure from data which has large scale and plus-minus difference with minimum limit using Python and matplotlib.pyplot

This page shows my suggestion to generate contour figure from data which has large scale and plus-minus difference using python and matplotlib.pyplot. The minimum value and maximum value can be specified in this code.

Combine two contourf and two colorbar into one figure using Python and matplotlib.pyplot


The result is:

Combine two contourf and two colorbar into one figure using Python and matplotlib.pyplot

This page shows how to combine two contourf and two colorbar into one figure using python and matplotlib.pyplot.

Combine multiple line plot and contour plot with a colorbar using Python and matplotlib.pyplot


The result is:
Combine multiple line plot and contour plot with a colorbar using Python and matplotlib.pyplot

This code shows how to combine multiple line plots and contour plots with a colorbar in one figure using Python and matplotlib.pyplot. To combine these plots, plt.subplots with gridspec_kw options are used. The xlims are also adjusted between upper and lower plots.

Plot contour figure from data which has large scale and plus-minus difference using Python and matplotlib.pyplot


The result is:

Plot contour figure from data which has large scale and plus-minus difference using Python and matplotlib.pyplot modified

This page shows my suggestion to generate contour figure from data which has large scale and plus-minus difference using python and matplotlib.pyplot.

Draw second colorbar axis outside of first axis


The result is:
Draw second colorbar axis outside of first axis

This code shows how to draw second colorbar axis outside of first colorbar axis.

Plot 1D data which has large scale and plus-minus difference using Python and matplotlib.pyplot


The result is:

Plot 1D data which has large scale and plus-minus difference using Python and matplotlib.pyplot original
Plot 1D data which has large scale and plus-minus difference using Python and matplotlib.pyplot modified

This page shows my suggestion to generate 1D line figure from data which has large scale and plus-minus difference using python and matplotlib.pyplot.

Add second x-axis below first x-axis using Python and matplotlib.pyplot


The result is:

Add second x-axis below first x-axis using Python and matplotlib.pyplot

This page shows how to draw second x-axis below the first x-axis. Using "twinx", "set_ticks_position", and "set_label_position", and "spines['bottom'].set_position", you can move the second x-axis from the top of the figure to below the first x-axis.

Add second x-axis at top of figure using Python and matplotlib.pyplot


The result is:

Add second x-axis at top of figure using Python and matplotlib.pyplot

This page shows how to add second x-axis at the top of the figure using python and matplotlib.pyplot. Using "twinx" funcion, you can add x-axis at the top of the figure.

Make figures changing math font in Python Matplotlib.pyplot


The example of the result (computer modern font) is:


This page shows how to change text font of the labels, ticks and mathtext.

Write \mu (Greek letter, Symbol) in Python Matplotlib.pyplot


The results are:
Write \mu (Greek letter, Symbol) in Python Matplotlib.pyplot times
Write \mu (Greek letter, Symbol) in Python Matplotlib.pyplot arial

This page shows how to write μ:mu, \mu in the matplotlib. By specifying the Unicode, you can add arbitrary character to the plot.

How to arrange two ylabels using Python Matplotlib.pyplot


The result is:


This page shows how to strictly align two ylabels.

One ylabel for two subplots using Python Matplotlib.pyplot


The result is:

One ylabel for two subplots using Python Matplotlib.pyplot

This page shows how to write one label on two subplots using python and matplotlib.pyplot. By set label_coords of the ylabel, you can move the position of the ylabel.