Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8855993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:15:36+00:00 2026-06-14T14:15:36+00:00

I use the simple code below to generate a boxplot with the labels of

  • 0

I use the simple code below to generate a boxplot with the labels of the x-values changed:

subplot(221)
boxplot(list_of_lists_of_lengths)
xlabel('max gap')
ylabel('cluster lengths')
xticks(range(len(max_distance)), max_distance, size='small')

As you can see the x values are not correctly offset- I want 0 to be below the first box and 100 below the second.

Played around with it, can’t find the answer. Please help!

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:15:38+00:00Added an answer on June 14, 2026 at 2:15 pm

    Use

    locs, labels = plt.xticks()
    

    to find out the locations where matplotlib was going to place the xtick marks. Then change the labels:

    plt.xticks(locs, max_distance, size='small')
    

    For example,

    import matplotlib.pyplot as plt
    
    list_of_lists_of_lengths = [range(1000),range(500,2000)]
    plt.subplot(1,1,1)    
    plt.boxplot(list_of_lists_of_lengths)
    plt.xlabel('max gap')
    plt.ylabel('cluster lengths')
    max_distance = (0, 100)
    locs, labels = plt.xticks()
    plt.xticks(locs, max_distance, size='small')
    plt.show()
    

    produces

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My requirement is to generate PDF file using iText, I use below code to
Am I missing something? I use this simple code <a name=fb_share type=button href=https://www.facebook.com/sharer.php?u=123.abc.comt=TEst>share on
If i use some really simple code like : $('#elm').tipTip(); It will do what
How do you guys write comments on some simple code that you use just
Using the following code: use LWP::Simple; my $url= http://example.com; my $html= get $url; I
A common piece of code I use for simple string splitting looks like this:
In my open-source plain C code I use this simple structure to read and
Question simple and quick: I have started to use Netbeans to write some code
I use this code: http://blogswizards.com/plugin-development/sliding-boxes-and-captions-with-jquery On a simple gallery site I am building. Specifically
I'm writing a simple Javascript library that makes use of some WebGL code. I'd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.