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

  • SEARCH
  • Home
  • 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 6675291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:50:12+00:00 2026-05-26T03:50:12+00:00

I just simply save the data into files and read them out and then

  • 0

I just simply save the data into files and read them out and then draw histogram. However, it appears this mistake though I changed nothing from the original code actually. Could anyone tell me what’s wrong? Thanks a lot.

Here is the code for hist()

f_120 = plt.figure(1)
plt.hist(tfirst_list, bins=6000000, normed = True, histtype ="step", cumulative = True, color = 'g',label = 'first answer')
plt.axvline(x = 30, ymin = 0, ymax = 1, color = 'r', linestyle = '--', label = '30 min')
plt.axvline(x = 60, ymin = 0, ymax = 1, color = 'c', linestyle = '--', label = '1 hour')
plt.legend()

plt.ylabel('Percentage of answered questions')
plt.xlabel('Minutes elapsed after questions are posted')
plt.title('Cumulative histogram: time elapsed \n before questions receive answer (first 2 hrs)')
plt.ylim(0,1)
plt.xlim(0,120)

f_120.show()

f_2640 = plt.figure(2)
plt.hist(tfirst_list, bins=6000000, normed = True, histtype ="step", cumulative = True, color = 'g',label = 'first answer')
plt.axvline(x = 240, ymin = 0, ymax = 1, color = 'r', linestyle = '--', label = '4 hours')
plt.axvline(x = 1440, ymin = 0, ymax = 1, color = 'c', linestyle = '--', label = '1 day')
plt.legend(loc= 4)

plt.ylabel('Percentage of answered questions')
plt.xlabel('Minutes elapsed after questions are posted')
plt.title('Cumulative histogram: time elapsed \n before questions receive answer (first 48)')
plt.ylim(0,1)
plt.xlim(0,2640)

f_2640.show()

And there is the full-text for the error:

 plt.hist(tfirst_list, bins=6000000, normed = True, histtype ="step",
          cumulative = True, color = 'b',label = 'first answer')

  File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 2160, in hist
    ret = ax.hist(x, bins, range, normed, weights, cumulative, bottom, histtype,
                  align, orientation, rwidth, log, color, label, **kwargs)

  File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 7606, in hist
    raise ValueError("color kwarg must have one color per dataset")

ValueError: color kwarg must have one color per dataset
  • 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-26T03:50:13+00:00Added an answer on May 26, 2026 at 3:50 am

    This problem is because you have defined tfirst_list as a N-dimensional array.
    For example:

    tfirst_list = [1, 2, 3, 4, 5, 6, 7, 8]        #works
    tfirst_list = [[1, 2, 3, 4], [5, 6, 7, 8]]    #produces the Exception you have
    

    If you are using N-dimensional data (N datasets), then the color keyword argument (color kwarg) must be also N-dimensional (one color per dataset). For example for the case above:

    color = ['b', 'r']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having a huge problem with this. Xcode just simply turned my landscape
This is simply just frustrating me to the brink of implosion. I do not
I probably just haven't thought this through, or perhaps I'm simply unaware of an
Simple question, I'm writing a series of text files into a zip, just wrapping
How can save data into a XML file without user prompt dialog in Action
For simple program data that needed to be saved I just used properties files
I am just simply creating a web application. I wanted to insert a line
The following modify method somehow modifies the whole @x array instead of just simply
I have a problem, i have a query that just simply displays the user
Simply, I'm just looking to get a list of connected remote disks. I have

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.