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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:24:33+00:00 2026-05-27T23:24:33+00:00

I’m trying to make a point and figure chart . I can get it

  • 0

I’m trying to make a point and figure chart. I can get it to work printing out on the terminal but I want to graph it with matplotlib. What would be the best way of doing something like this? I was thinking scatter, but when I do this the columns are spread out too far. I would like to get something much like the chart from the link I provided where the columns are as close to one another as possible. Is there a parameter I can overwrite to force this? First time using matplotlib so please excuse me if this is trivial. Thanks.

  • 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-27T23:24:34+00:00Added an answer on May 27, 2026 at 11:24 pm

    You can adjust the size of the symbols used in a scatter plot by choosing the s parameter. You also will likely need to adjust the size of your figure (with figsize) or the dimensions of your axes (with add_axes). This is because the symbols for scatter are square, in display units, and the x and y axis are not automatically adjusted so that width-of-one-change = height-of-one-box.

    In other words, the example you provided is a rectangular plot with the height > width, and the height and width are chosen to make the width-of-one-change == height-of-one-box.

    Here’s an example of apply these techniques:

    import matplotlib.pyplot as plt
    
    BOX = 5
    START = 365
    changes = (8, -3, 4, -4, 12, -3, 7, -3, 5, -9, 3)
    
    # one way to force dimensions is to set the figure size:
    fig = plt.figure(figsize=(5, 10))
    
    # another way is to control the axes dimensions
    # for axes to have specific dimensions:
    #                  [ x0,  y0,   w,   h]  in figure units, from 0 to 1
    #ax = fig.add_axes([.15, .15, .7*.5, .7])
    ax = fig.add_axes([.15, .15, .7, .7])
    
    def sign(val):
        return val / abs(val)
    
    pointChanges = []
    for chg in changes:
        pointChanges += [sign(chg)] * abs(chg)
    
    symbol = {-1:'o',
               1:'x'}
    
    chgStart = START
    for ichg, chg in enumerate(changes):
        x = [ichg+1] * abs(chg)
        y = [chgStart + i * BOX * sign(chg) for i in range(abs(chg))] 
        chgStart += BOX * sign(chg) * (abs(chg)-2)
        ax.scatter(x, y,
                   marker=symbol[sign(chg)],
                   s=175)   #<----- control size of scatter symbol
    
    ax.set_xlim(0, len(changes)+1)
    fig.savefig('pointandfigure.png')
    plt.show()
    

    The method developed for each scatter plot is very hackish, but the key point is that I needed to play with the scatter s parameter and the figure size to get something of the desired effect.

    The resulting plot is:

    enter image description here

    Ideally, one would make a custom method modeled after the scatter method. It would create a custom Collection instance that would include the x’s, o’s and month labels. It would also a) automatically adjust the axes/figure aspect or b) make asymmetric symbols. This is obviously an advanced option, intended for someone wishing to contribute, as a developer, to the Matplotlib project.

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I want to construct a data frame in an Rcpp function, but when I
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want use html5's new tag to play a wav file (currently only supported

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.