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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:51:54+00:00 2026-05-22T12:51:54+00:00

I am using pythons hist function to generate 1d histograms each linked to a

  • 0

I am using pythons hist function to generate 1d histograms each linked to a given experiment.
Now I understand that the Hist function allows one to plot multiple histograms on the same x axis for comparison. I normally use something akin to the following for this purpose and the result is a very nice plot where x1,x2 and x3 are defined as follows
x1 = lengths expt1
x2 = lengths expt2
x3 = lengths expt3

P.figure()
n, bins, patches = P.hist( [x0,x1,x2], 10, weights=[w0, w1, w2], histtype='bar')
P.show()

I was hoping to try achieve a 3d effect however and therefore I ask dose anyone know if it is it possible to have each unique histogram offset from the other in the y plane by a given unit thus generating a 3d effect.

I would appreciate any help on this .

  • 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-22T12:51:54+00:00Added an answer on May 22, 2026 at 12:51 pm

    I believe you just want matplotlib.pyplot.bar3d.

    import numpy as np
    import matplotlib.pyplot as plt
    from mpl_toolkits.mplot3d import Axes3D
    
    x0, x1, x2 = [np.random.normal(loc=loc, size=100) for loc in [1, 2, 3]]
    
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    
    yspacing = 1
    for i, measurement in enumerate([x0, x1, x2]):
        hist, bin_edges = np.histogram(measurement, bins=10)
        dx = np.diff(bin_edges)
        dy = np.ones_like(hist)
        y = i * (1 + yspacing) * np.ones_like(hist)
        z = np.zeros_like(hist)
        ax.bar3d(bin_edges[:-1], y, z, dx, dy, hist, color='b', 
                zsort='average', alpha=0.5)
    
    plt.show()
    

    enter image description here

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

Sidebar

Related Questions

I want to start using Python for small projects but the fact that a
I'm using python and CherryPy to create a simple internal website that about 2
I have a Python program that generates a histogram using matplotlib. The problem is
Trying to execute shell command in background using pythons commands module >>>import commands >>>output
I'm trying to execute a series of commands using Pythons subprocess module, however I
I'm trying to write a gui for FFMPEG . I'm using pythons subprocess to
I have a class that I wish to expose as a remote service using
I am using pythons built-in sqlite3 module to access a database. My query executes
Using python 2.4, I'm attempting to identify, at runtime, which of an arbitrary function's
I have a script that appends some rows to a table. One of the

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.