0

I have a data set (shared below) and I intend to plot the hf_gen(s) against the initial records. I used the following matplotlib script to generate the plot. I like to have my "x axis" figures in 10 to the powers of six. I tried using ScalarFormatter. The x axis is in powers of 9.

    import matplotlib.pyplot as plt
    from matplotlib.ticker import ScalarFormatter 

    fig = plt.figure()#figsize=(11,8)
    ax1 = fig.add_subplot(111)

    ax1.plot(bulk_ingest_data['initial_records'][0:5], bulk_ingest_data['hf_gen(s)'][0:5], color='r', marker='o', label='LAS data in text form') #500
    ax1.plot(bulk_ingest_data['initial_records'][5:10], bulk_ingest_data['hf_gen(s)'][5:10], color='b', marker='o', label='Binary encoded LAS points') #200
    ax1.xaxis.set_major_formatter(ScalarFormatter(useMathText=True))
    plt.xlabel('Number of records ingested)')
    plt.ylabel('HFile generation time(s)')
handles, labels = ax1.get_legend_handles_labels()
lgd = ax1.legend(handles, labels, loc='upper left')#, bbox_to_anchor=(1.15,1)
ax1.grid('on')

What is the correct way to make it powers of six, so that I have my x axis values in the powers of six having 3 digit value as the base value.

enter image description here

CoolCK
  • 416
  • 5
  • 16
  • Please don't post images of code or data. Copy and paste it as text then format it as code (select it and type `ctrl-k`) [Why not upload images of code on SO when asking a question?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question) ... [You should not post code as an image because:...](https://meta.stackoverflow.com/a/285557/2823755) – wwii Sep 11 '19 at 17:10
  • 1
    Possible duplicate of [How to format seaborn/matplotlib axis tick labels from number to thousands or Millions? (125,436 to 125.4K)](https://stackoverflow.com/questions/53747298/how-to-format-seaborn-matplotlib-axis-tick-labels-from-number-to-thousands-or-mi) – wwii Sep 11 '19 at 17:21
  • Maybe you mean [set-scientific-notation-with-fixed-exponent-and-significant-digits-for-multiple](https://stackoverflow.com/questions/42656139/set-scientific-notation-with-fixed-exponent-and-significant-digits-for-multiple)? – ImportanceOfBeingErnest Sep 11 '19 at 21:27

0 Answers0