Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help With Sub Plots
#1
Hi all

I was wondering if anyone could help with my understanding when it comes to sub plotting.

I have looked at the documentation and examples for creating sub plots.

The firstly the example i found on the matplot lib web site shows how to create a sub plot.

# Create two subplots and unpack the output array immediately
f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
ax1.plot(x, y)
ax1.set_title('Sharing Y axis')
ax2.scatter(x, y)
What is the purpose of the letter f or fig on line 2, i can remove or replace the letter f and the code works fine, can anyone tell me what this letter means/refers to?

I am trying to create a figure which contains 3 subplots i.e. 3 rows and 1 column.

I have started the code off as:-

pyplot.figure("Wall_Height", figsize=(5,5))
This creates a new figure window called Wall Height and is of size 5 x 5.

Within this figure window i want to create 3 subplots i have attempted to do this using the following code:-

Wall_Height, (plot1, plot2, plot3) = pyplot.subplots(3,1)
But all this does is create an empty figure window called Wall_Height and a second figure window with the empty subplots.

How can i create the sub plots within my figure window called Wall_Height?

Attached is a screen shot of the plots and code.

Any help will be greatly appreciated.

Thank you.

Attached Files

Thumbnail(s)
   
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Multiple Plots in Spyder PythonAndMe2023 0 868 Feb-03-2023, 07:00 PM
Last Post: PythonAndMe2023
  Subplot - Plotting 4 plots on the same row Menthix 1 1,417 Nov-07-2021, 09:03 PM
Last Post: deanhystad
  Sharing X Axis in Sub plots JoeDainton123 1 2,177 Aug-22-2020, 04:11 AM
Last Post: deanhystad
  Group scatter plots Mekala 0 1,643 Jul-23-2020, 02:18 PM
Last Post: Mekala
  Saving multiple plots as pdf mohd_umair 0 3,338 Apr-28-2019, 01:21 PM
Last Post: mohd_umair
  Can't locate plots package BobLoblaw 12 10,928 Oct-04-2017, 11:56 PM
Last Post: BobLoblaw
  Adding text to plots shaynehansen 0 3,322 Jul-10-2017, 05:54 PM
Last Post: shaynehansen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020