• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

How to align the size of Plot Areas|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / How to align the size of Plot Areas|VBA & Macros|Excel Forum|My Online Training Hub

office scripts course

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosHow to align the size of Plot Areas
sp_PrintTopic sp_TopicIcon
How to align the size of Plot Areas
Avatar
Matthias
Member
Members
Level 0
Forum Posts: 49
Member Since:
December 13, 2017
sp_UserOfflineSmall Offline
1
November 15, 2018 - 11:26 am
sp_Permalink sp_Print

Hello,

"Small Multiples are a great way to visualise a lot of related data in a small space and still make comparisons.
The key is that they all must share the same axis scale, so they can be compared equally.
Because they all share the same axis, we can use one axis for each row and then remove them from the other charts to create a less cluttered look.
Likewise for the horizontal axis."

Problem: When you remove an axis (x or y) the size of the plot area changes. You can align the plot area manually by placing the chart without axis on top of the chart with (set the fill of the chart without axis to No Fill) and then fidle around. There a maximum of 3 charts to be ajusted: w/o x axis; w/o y axis; w/o y and x axis. I hope it gets clear when you look at the atached file.

So tried to simply print out the original ? ActiveChart.PlotArea.width and ? ActiveChart.PlotArea.width and then copy it to the duplicated chart(s): 

Sub PlotAreaSize()
 ActiveChart.PlotArea.Width = xy
 ActiveChart.PlotArea.Height = yz
End Sub

But it did not render the intended equal size. I also tried reapplying the original size after deleting the axis with the same luck. You can see 4 different sizes as result in the attached file (small and big distortions) and also the position of the remaining axis seems to be shifted (inside / up).

Sub ReapplyPlotAreaSize()

Dim w As Variant
Dim h As Variant

w = ActiveChart.PlotArea.Width
h = ActiveChart.PlotArea.Height

 ActiveChart.Axes(xlValue).Delete                                 'comment out if not needed
 ActiveChart.Axes(xlCategory).Delete                            'comment out if not needed
 ActiveChart.ChartArea.Format.Fill.Visible = msoFalse     'to compare the results against original chart (place on top)

ActiveChart.PlotArea.Width = w
ActiveChart.PlotArea.Height = h

End Sub

What is the problem and what would be the correct way to align the Plot Area size? Any way to fix the Plot area position?

Thanks,
Matthias

sp_AnswersTopicSeeAnswer See Answer
Avatar
Velouria
London or thereabouts
Moderator
Members


Trusted Members

Moderators
Level 4
Forum Posts: 688
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
2
November 15, 2018 - 8:03 pm
sp_Permalink sp_Print

Instead of deleting the axes, you could simply hide the lines and make the labels the same colour as the chart area, so it won't resize at all:

 

Dim fillColour As Long
With ActiveChart
fillColour = .ChartArea.Fill.ForeColor
With .Axes(xlValue)
.Format.Line.Visible = False
.TickLabels.Font.Color = fillColour
End With
With .Axes(xlCategory)
.Format.Line.Visible = False
.TickLabels.Font.Color = fillColour
End With
End With

sp_AnswersTopicAnswer
Answers Post
Avatar
Matthias
Member
Members
Level 0
Forum Posts: 49
Member Since:
December 13, 2017
sp_UserOfflineSmall Offline
3
November 16, 2018 - 2:48 am
sp_Permalink sp_Print

Thanks Velouria! It does not answer the questions - but it solves the problem. 🙂

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Leigh Thomas
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
jaryszek: 183
Newest Members:
Trevor Pindling
Stevan Kanjo
Erin Sheldon
Nikita Bhatia
Sheilah Taylor
Clare Webber
David Jenssen
Dominic Brosnahan
Young You
Jennifer Owens
Forum Stats:
Groups: 3
Forums: 24
Topics: 6524
Posts: 28554

 

Member Stats:
Guest Posters: 49
Members: 32808
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate
  • Sponsor Our Newsletter

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.