2

I've got these two lists which are x,y points to be plotted:

microns = [38,  45,  53,  63,  75,  90, 106, 125, 150, 180]
cumulative_dist = [25.037, 32.577, 38.34, 43.427, 51.57,56.99, 62.41,69.537,74.85, 81.927]

The thing is I need to plot them following the scale showed in the image below (more info here), which is a log-normal plot.

How can I get this scale using matplotlib?

I guess I'll need to use matplotlib.scale.FuncScale, but I'm not quite sure how to get there.

enter image description here

2
  • 2
    Looks like you want to use probplot? matplotlib.org/mpl-probscale/tutorial/… Commented Sep 18, 2020 at 12:29
  • It looks like what I want. I'll have a look at it. Thank you for that. Commented Sep 18, 2020 at 12:30

1 Answer 1

0

After David's insightful comment I've read this page and managed to plot the Figure the way I wanted.

enter image description here

from matplotlib.ticker import ScalarFormatter, AutoLocator
from matplotlib import pyplot
import pandas as pd
import probscale
fig, ax = pyplot.subplots(figsize=(9, 6))
microns = [38,  45,  53,  63,  75,  90, 106, 125, 150, 180]
cumulative_dist = [25.037, 32.577, 38.34, 43.427, 51.57,56.99, 62.41,69.537,74.85, 81.927]
probscale.probplot(pd.Series(microns, index=cumulative_dist), ax=ax, plottype='prob', probax='y', datascale='log',
                   problabel='Cumulative Distribution (%)',datalabel='Particle Size (μm)',
                   scatter_kws=dict(marker='.', linestyle='none', markersize=15))
ax.set_xlim(left=28, right=210)
ax.set_ylim(bottom=1, top=99)
ax.set_title('Log Normal Plot')
ax.grid(True, axis='both', which='major')
formatter = ScalarFormatter()
formatter.set_scientific(False)
ax.xaxis.set_major_formatter(formatter)
ax.xaxis.set_minor_formatter(formatter)
ax.xaxis.set_major_locator(AutoLocator())
ax.set_xticks([])  # for major ticks
ax.set_xticks([], minor=True)  # for minor ticks
ax.set_xticks(microns)
fig.show()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.