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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:22:45+00:00 2026-06-10T09:22:45+00:00

I want to insert some arrows into a plot of some exponential distributions: import

  • 0

I want to insert some arrows into a plot of some exponential distributions:

import pylab as pl
import numpy as np


def gauss2d(x,sigma):
    return (1/np.sqrt(2*np.pi*sigma ))*np.exp(-1/2*(x/sigma)**2 )

def draw_arrow(zero, sigma, function):
    startx = zero
    print startx,function(sigma, sigma)
    arr = pl.Arrow(startx,function(startx+sigma, sigma), sigma,0,fc="k",ec="k")
    ax = pl.gca()
    ax.add_patch(arr)

def plot_gauss2d():
    x = np.mgrid[115:135:100j]
    #x=np.array(zip(range(5)),dtype=float)
    sigma = 1
    off=1.0
    pl.plot(x,gauss2d(x-126.21,3.56), 'b-')
    draw_arrow(126.21, 3.56, gauss2d)
    pl.plot(x,gauss2d(x-126.71,4.57), 'b-')
    pl.plot(x,gauss2d(x-120.64,3.5), 'b-')
    pl.ylabel('frequency')
    pl.xlabel('ppm of N')
    pl.title
    pl.show()

def main():
    plot_gauss2d()                                                             

if __name__ == "__main__":
    main()

example1

Somehow I can’t seem to get the arrow right. What I essentially would like to have is something like this:

wish

what I simply cannot figure out is how to set the arrow straight to where I want it to be. It should mark the point of the standard deviation in the correct height. The whole thing should of course produce multiple exponential curves.

  • 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-10T09:22:47+00:00Added an answer on June 10, 2026 at 9:22 am

    The problem with arrow is that it uses the figure coordinate as compared to the data coordinates. Hence, as @Paul have suggested, you can use annotate, as

    import pylab as pl
    import numpy as np
    
    
    def gauss2d(x,sigma):
        return (1/np.sqrt(2*np.pi*sigma ))*np.exp(-1/2*(x/sigma)**2 )
    
    def markParameters(m,s):
        p1=gauss2d(s,s)
        p2=gauss2d(0,s)
    
        pl.annotate("", xy=(m-s, p1), xycoords='data', xytext=(m+s, p1), textcoords='data', arrowprops=dict(arrowstyle="<->", connectionstyle="arc3"),)
        pl.text(m,p1,'sigma',horizontalalignment='center',verticalalignment='top')
        pl.annotate("", xy=(m, 0), xycoords='data', xytext=(m, p2), textcoords='data', arrowprops=dict(arrowstyle="<->", connectionstyle="arc3"),)
        pl.text(m,p2*0.75,'mean',horizontalalignment='right',verticalalignment='center',rotation=90)
    
    def plot_gauss2d():
        x = np.mgrid[115:135:100j]
        #x=np.array(zip(range(5)),dtype=float)
        m,s=126,3.56
    
        pl.plot(x,gauss2d(x-m,s), 'b-')
        markParameters(m,s)
    
        pl.ylabel('frequency')
        pl.xlabel('ppm of N')
        pl.title
        pl.show()
    
    def main():
        plot_gauss2d()
    
    if __name__ == "__main__":
        main()
    

    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 insert some data into a table (id PK autoincrement, val) with
So, I want to insert some data into a MySQL table where the table
I want to insert some data into a table associated with dates for the
I want to make simple java program that will insert some text into current
I want to insert some simple data the query is: INSERT INTO categories_lang (category_id,language_id,name,description,alias)
I want to insert some values into an SQLite table. The query is: insert
I want to insert some element(s) into a vector at the run time. Here
I want to insert some data into a table and I want the multiple
I want to use javascript to insert some elements into the current page. Such
i want to insert some data into a data table, for a wordpress plugin.

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.