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 588755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:21:07+00:00 2026-05-13T15:21:07+00:00

Here’s a plot I made using matplotlib . It uses the bar and scatter

  • 0

Here’s a plot I made using matplotlib. It uses the bar and scatter methods from pylab.
I have 3 issues:

How to make the error bars fatter? No API in bar for this that I can see.
How to specify the axes properly?
How to stop the x-axis labels from showing?

The first is most important, as I have no idea. I guess one more thing would be, how to display the image here in SO? I’ve seen it done but don’t know how.

Here is the code:

import numpy as np
from pylab import *

data1 = np.linspace(12,22,7)
data2 = np.random.normal(loc=15,scale=5,size=10)
data3 = [11,12,18,19,20,26,27]
data = [data1,np.abs(data2),data3]

# n = number of groups
def layout(n,r=7):
    s = r**2   # r = radius of each data point
    #layout from 1 to 100
    margin = 5
    spacer = 10
    group_width = (100 - 2*margin - (n-1)*spacer)*1.0/n
    dot_width = r
    bar_width = group_width - dot_width
    current = margin
    rL = list()
    for i in range(n):
        rL.append(current)        # x for point
        rL.append(current + 3)    # x for bar
        current += group_width + spacer
    return s, bar_width, rL   

s, w, xlocs = layout(len(data))
for group in data:
    x = xlocs.pop(0)
    for e in group:
        scatter(x,e,s=s,color='k')
    m = np.mean(group)
    e = np.std(group)
    x = xlocs.pop(0)
    o = bar(x,m,width=w,color='0.6',
        yerr=e, ecolor='k')

show()

alt text http://img210.imageshack.us/img210/8503/screenshot20100206at703.png

  • 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-05-13T15:21:08+00:00Added an answer on May 13, 2026 at 3:21 pm

    The error bars are drawn with the errorbar method from within the bar method. It accepts an elinewidth argument but it doesn’t look like you can pass it through the bar method call. I would just draw them manually.

    o, = bar(x,m,width=w,color='0.6', yerr=None) # note the comma after the o
    eBarX = o.get_x()+o.get_width()/2.0
    eBarY = o.get_height()
    errorbar(eBarX,eBarY,e,capsize=7,elinewidth=6,ecolor='k')
    

    To turn the XAxis off use this before you call show:

    axes().xaxis.set_visible(False)
    

    These changes make your plot look like this:
    alt text http://img690.imageshack.us/img690/5141/testfs.png

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

Sidebar

Ask A Question

Stats

  • Questions 297k
  • Answers 297k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you don't need to process the output in your… May 13, 2026 at 7:15 pm
  • Editorial Team
    Editorial Team added an answer would this be something that potentially keep adding additional WAV… May 13, 2026 at 7:15 pm
  • Editorial Team
    Editorial Team added an answer Consider using Boost.Regex. An example (from the website): bool validate_card_format(const… May 13, 2026 at 7:15 pm

Related Questions

Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.