Python script for plotting - PhysLab

  • Home
  • About Us
    • Overview
    • Centre for Experimental Physics Education (CEPE)
    • Physlab Team
    • Physlab Guidebook
    • Alumni
    • Open Positions
    • Muhammad Sabieh Anwar (Personal)
  • Academics
      • Lab Courses
      • Lab-I (ENGG-100/PHY-100/200)
      • Lab-II (PHY 300/500)
      • AstroLAB
      • Ibn Sahl Corner for Optics
      • Fast Optics
      • Smart Physics
      • Single Photon Quantum Mechanics Lab
      • Chasing Cosmic Ray Muons at Physlab
      • Stories
      • Physics Studio
      • Research Stories
      • Class Activities
      • Courses Taught
      • Class Demonstrations
      • PhysDiary
      • Health and Safety
      • Lab Safety
      • Workplace Organization
  • Research
    • Research Themes
    • Research Internships
    • Research Stories
    • Physics WorldCup
      • International Young Physicists’ Tournament (IYPT) 2019
      • International Young Physicists’ Tournament (IYPT) 2018
      • International Young Physicists’ Tournament (IYPT) 2016
    • Hunerkada
    • Grants
    • Theses and Reports
    • Scientific Publications
    • Invited Talks (Selected)
  • Outreach
    • Media
      • Lectures, Podcasts and Interviews
      • Videobytes
      • YouTube Channel
      • Visitors
      • Testimonials
    • The Scientific Mind Through the Eyes of a Physics Experimenter
    • National Laboratory Immersion Program
      • First Lahore 2012
      • Second Sukkur 2013
      • Third Lahore 2014
      • Fourth Lahore 2016
    • Labview Workshop 2016
    • Open house
      • 2009-2015
      • Open house 2023
    • Khwarizmi Science Society
    • Helping Pakistan’s Universities
      • National University of Technology (NUTECH) 2019
      • Pakistan Institute of Engineering and Applied Sciences
        (PIEAS) 2019 (Final Phase)
      • Pakistan Institute of Engineering and Applied Sciences
        (PIEAS) 2019 (Phase 2)
      • Pakistan Institute of Engineering and Applied Sciences
        (PIEAS) 2018 (Phase 1)
      • National University of Science & Technology 2016
      • Habib University 2014
      • Preston University 2013
      • Ghulam Ishaque Khan Institute of
        Engineering Sciences and Technology 2011
      • Institute of Space Technology 2010
    • The National STEM School
      • STEM School (2018 – 2019)
      • STEM school (2016 – 2017)
    • Abdus Salam Memorial Lecture Series
  • Facilities
    • Laboratories
    • Equipments
    • Devices & Softwares
      • PhysPlot
      • Physlogger
      • Phystrack
    • Mechanical Workshop
    • Inventory
    • 3D Printed Galleria
    • Forms
    • Equipment Howto’s
  • PhysGPT
  • Contact Us

Python script for plotting

Home \

# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt

import numpy as np

#Direct input

plt.rcParams[‘text.latex.preamble’]=r’\usepackage{lmodern}’

#Options

params = {‘text.usetex’:True,’font.size’:11,’font.family’:’serif’,’figure.autolayout’: True}

plt.rcParams.update(params)

# Data for plotting

k1 = 3

k2 = 1

x1 = np.linspace(-10, 15, 200)

wf1 = np.cos(k1*x1)

wf2  = np.exp(-0.07*x1)

wf3 = np.exp(-0.07*5)*np.cos(1.5*(x1-5))

fig, (ax1,ax2,ax3) = plt.subplots(1,3, gridspec_kw={‘wspace’:0,’width_ratios’: [2, 1,2]},sharey=True)

ax1.plot(x1,wf1,’–b’,label=r’$Re[\psi_1(x)]$’)

ax1.legend(loc=’upper left’,fontsize=16, fancybox=True, framealpha=0.0)

ax2.plot(x1,wf2,’r’,label=r’$\psi_2(x)$’)

ax2.legend(loc=’upper left’,fontsize=12, fancybox=True, framealpha=0.0)

ax3.plot(x1,wf3,’–g’,label=r’$Re[\psi_3(x)]$’)

ax3.legend(loc=’upper left’,fontsize=16, fancybox=True, framealpha=0.0,labelcolor=’linecolor’)

ax1.set_xlim((-10,0))

ax2.set_xlim((0,5))

ax2.set_ylim((-1.2,1.6))

ax3.set_xlim((5,15))

ax2.set_xlabel(r’$x$’,fontsize=18)

ax2.yaxis.set_ticks_position(‘none’)

ax3.yaxis.set_ticks_position(‘none’)

fig.savefig(“wavefunction.pdf”)

plt.show(block=False)

PhysLab

Preparing an institutional and national platform for student-driven experimental research in physics.

CONTACT US

Email: [email protected] Telephone: 111-11-LUMS (5867) Address: Lahore University of Management Sciences (LUMS), Sector U, DHA, Lahore Cantt. 54792, Pakistan
TOP
© 2007-2024 PhysLAB, Lahore University of Management Sciences - All Rights Reserved.
  • Home
  • About Us
    • Overview
    • Centre for Experimental Physics Education (CEPE)
    • Physlab Team
    • Physlab Guidebook
    • Alumni
    • Open Positions
    • Muhammad Sabieh Anwar (Personal)
  • Academics
    • Lab Courses
    • Lab-I (ENGG-100/PHY-100/200)
    • Lab-II (PHY 300/500)
    • AstroLAB
    • Ibn Sahl Corner for Optics
    • Fast Optics
    • Smart Physics
    • Single Photon Quantum Mechanics Lab
    • Chasing Cosmic Ray Muons at Physlab
    • Stories
    • Physics Studio
    • Research Stories
    • Class Activities
    • Courses Taught
    • Class Demonstrations
    • PhysDiary
    • Health and Safety
    • Lab Safety
    • Workplace Organization
  • Research
    • Research Themes
    • Research Internships
    • Research Stories
    • Physics WorldCup
      • International Young Physicists’ Tournament (IYPT) 2019
      • International Young Physicists’ Tournament (IYPT) 2018
      • International Young Physicists’ Tournament (IYPT) 2016
    • Hunerkada
    • Grants
    • Theses and Reports
    • Scientific Publications
    • Invited Talks (Selected)
  • Outreach
    • Media
      • Lectures, Podcasts and Interviews
      • Videobytes
      • YouTube Channel
      • Visitors
      • Testimonials
    • The Scientific Mind Through the Eyes of a Physics Experimenter
    • National Laboratory Immersion Program
      • First Lahore 2012
      • Second Sukkur 2013
      • Third Lahore 2014
      • Fourth Lahore 2016
    • Labview Workshop 2016
    • Open house
      • 2009-2015
      • Open house 2023
    • Khwarizmi Science Society
    • Helping Pakistan’s Universities
      • National University of Technology (NUTECH) 2019
      • Pakistan Institute of Engineering and Applied Sciences
        (PIEAS) 2019 (Final Phase)
      • Pakistan Institute of Engineering and Applied Sciences
        (PIEAS) 2019 (Phase 2)
      • Pakistan Institute of Engineering and Applied Sciences
        (PIEAS) 2018 (Phase 1)
      • National University of Science & Technology 2016
      • Habib University 2014
      • Preston University 2013
      • Ghulam Ishaque Khan Institute of
        Engineering Sciences and Technology 2011
      • Institute of Space Technology 2010
    • The National STEM School
      • STEM School (2018 – 2019)
      • STEM school (2016 – 2017)
    • Abdus Salam Memorial Lecture Series
  • Facilities
    • Laboratories
    • Equipments
    • Devices & Softwares
      • PhysPlot
      • Physlogger
      • Phystrack
    • Mechanical Workshop
    • Inventory
    • 3D Printed Galleria
    • Forms
    • Equipment Howto’s
  • PhysGPT
  • Contact Us