Closed Thread
Results 1 to 19 of 19

How to resize plot areas so that graphs are uniform?

  1. #1
    Registered User
    Join Date
    08-31-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Question How to resize plot areas so that graphs are uniform?

    Hi,

    I have many graphs (60+) and I have realised that, for whatever reason, some of the plot areas do not match in size despite the fact that the charts themselves have identical proportions.

    Is there any way to fairly quickly fix this? I pasted the charts directly into Word 2007 (i.e. so they are editable), but this was a while ago and they do not match the original ones anymore so I will need to edit them in Word.

    Any ideas?

    Thanks,

    SB

  2. #2
    Registered User
    Join Date
    08-31-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: How to resize plot areas so that graphs are uniform?

    It doesn't need to be the fastest method possible, I would rather be able to achieve uniform dimension graphs than not at all! Unfortuantely I don't think I can use templates since the content of the graphs vary quite a lot.

    Thanks,

    SB

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,428

    Re: How to resize plot areas so that graphs are uniform?

    Do the charts have the same x and y axis labelling and how about the legend text?

    The plot area will be adjusted automatically to allow for variations in the size/amount of text.

    To force the sizing of the plotarea you would need code to loop through and adjust it's width/height/top/left.

    The code to loop and change is straight forward. What is not is what values to use. How do you know which dimensions should be used on all the charts?
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    08-31-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: How to resize plot areas so that graphs are uniform?

    Quote Originally Posted by Andy Pope View Post
    Do the charts have the same x and y axis labelling and how about the legend text?

    The plot area will be adjusted automatically to allow for variations in the size/amount of text.

    To force the sizing of the plotarea you would need code to loop through and adjust it's width/height/top/left.

    The code to loop and change is straight forward. What is not is what values to use. How do you know which dimensions should be used on all the charts?
    Thanks for the reply Andy. Almost all the charts have different x and y labels, also the legend position and contents varies considerably. I think I must have manually edited some of the plot areas at some point because they do not necessaraly match for otherwise identical charts. e.g:

    Example.

    These two empty graphs have the same dimensions when you select them, but the plot areas do not match.

    There is no exact answer as to what the plot area dimensions should be, but the outside dimensions are 7.5cm by 15.92cm. So essentially they just need to be uniform and fill most of the width of one sheet of A4 paper (15.92cm + 2x2.54cm margins) and most of the 7.5cm chart height. How would I go about writing the code?

    Thanks,

    SB
    Last edited by Silverbrook; 09-01-2009 at 08:22 AM.

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,428

    Re: How to resize plot areas so that graphs are uniform?

    are the charts in excel or word.

    Can you post a file rather than a image.

  6. #6
    Registered User
    Join Date
    08-31-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: How to resize plot areas so that graphs are uniform?

    Quote Originally Posted by Andy Pope View Post
    are the charts in excel or word.

    Can you post a file rather than a image.
    The images are now in word. I have uploaded an example file showing what the problem is (the original file is rather large!).
    Attached Files Attached Files

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,428

    Re: How to resize plot areas so that graphs are uniform?

    This is a cheap and cheerful fix

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-31-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: How to resize plot areas so that graphs are uniform?

    Thanks for that Andy, your help is much appreciated. It works well, though I had trouble with one or two for some reason. Is there any way to make it so that it just resizes the currently selected graph?
    Last edited by shg; 09-03-2009 at 01:36 PM. Reason: deleted spurious quote

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,428

    Re: How to resize plot areas so that graphs are uniform?

    I can not get at the chart object via the Selection object.
    Nor can I identify what the selected item is called.

    If the code is missing some charts it maybe because they are in the shapes collection rather the InLineShapes collection.

  10. #10
    Registered User
    Join Date
    08-31-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: How to resize plot areas so that graphs are uniform?

    Thanks Andy. I suppose I could open a new word document and transfer the charts I want resizing and run the macro on those and then transfer them back. It certainly beats doing it manually with the ruler guides!!
    Last edited by shg; 09-03-2009 at 01:37 PM. Reason: deleted spurious quote

  11. #11
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,428

    Re: How to resize plot areas so that graphs are uniform?

    I took a break and had another bash.

    Try this on a selected chart

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    08-31-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Thumbs up Re: How to resize plot areas so that graphs are uniform?

    Works perfectly, thanks! I figured out why a couple of them didn't resize 'correctly', it was because I had forgotten to change the font size of the y-axis to the same as the others, it made the end result slightly different but I have changed that now. Cheers Andy, the help has been massively appreciated!
    Last edited by shg; 09-03-2009 at 01:37 PM. Reason: deleted spurious quote

  13. #13
    Registered User
    Join Date
    08-31-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Red face Re: How to resize plot areas so that graphs are uniform?

    I've just had another thought (sorry!!) is there a way to modify the code so that it will position a legend in a particular place? Also would it be possible with horizontal/vertical axes titles?

  14. #14
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How to resize plot areas so that graphs are uniform?

    Silverbrook, kindly don't quote whole posts. It's just clutter.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  15. #15
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,428

    Re: How to resize plot areas so that graphs are uniform?

    You just need to add the code to control the right part of the charts object model.

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    08-31-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: How to resize plot areas so that graphs are uniform?

    Thanks Andy, I really appreciate the help. I have no more questions!

  17. #17
    Registered User
    Join Date
    02-14-2012
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: How to resize plot areas so that graphs are uniform?

    I found this thread online. I am relatively new to macros and need to know how to set up the environment to make the macro run correctly. Right now I copy/paste it into the code window and press run but then I get an error.

    Thanks for any help you can provide.

  18. #18
    Registered User
    Join Date
    02-14-2012
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: How to resize plot areas so that graphs are uniform?

    I am using Excel.

  19. #19
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: How to resize plot areas so that graphs are uniform?

    bwand8gv,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1