SlideShare a Scribd company logo
Programa de Física
Docente: Carlos Andrés Vidal Betancourt
Física Computacional I
S4 – Matplotlib
Overview
Matplotlib is a library for making 2D plots in
Python. It is designed with the philosophy
that you should be able to create simple
plots with just a few commands.
… a quote …
Matplotlib
Beginners - Handout
Choose
Matplotlib offers several
kinds of plots.
Beginners - Handout
Beginners - Handout
Tweak
You can modify pretty much
anything in a plot, including
limits, colors, markers, line
width and styles, ticks and
ticks labels, titles, etc.
Beginners - Handout
Organize
You can plot several data on the same figure, but you can also split a figure in several subplots (named Axes)
Beginners - Handout
Label
(everything)
Explore Save
(bitmap or
vector format)
Figures are shown with a graphical user interface that allows to zoom
and pan the figure, to navigate between the different views and to
show the value under the mouse.
Intermediate users
A matplotlib figure is
composed of a hierarchy
of elements that forms the
actual figure. Each
element can be modified.
Intermediate users
Intermediate users
Intermediate users
Intermediate users
Intermediate users
Consider a square figure to be included in a two-column A4
paper with 2 cm margins on each side and a column
separation of 1cm. The width of a figure is (21-2*2-1)/2 =8cm.
One inch being 2.54 cm, figure size should be 3.15×3.15 in
Any color can be used, but Matplotlib offers sets of colors
Advanced plots
Stem
Advanced plots
Step
Advanced plots
Scatter plot
Advanced plots
Fill
Advanced plots
Polar plot
Advanced plots
Polar bar plot
Advanced plots
3D surface (Colormap)
Advanced plots
Discrete
distribution
has
horizontal
bar chart
Advanced plots
Violinplot
Advanced plots
Streamplot
Advanced plots
Image
Corrections
Advanced plots
Rendering
(Mandelbrot)
Tips & tricks
Scatter plots can be enhanced by using transparency (alpha) to show areas with
higher density. Multiple scatter plots can be used to delineate a frontier.
If your figure has many graphical elements, such as a huge scatter, you can
rasterize them to save memory and keep other elements in vector format.
You can use colormap to pick from a range of continuous colors.
Use the Agg backend to render
a figure directly in an array.
Tips & tricks
You can plot several lines at
once using None as separator.
Use text outline to make
text more visible.
Tips & tricks
You can use overlaid axes
with different projections.
To have rounded dotted
lines, use a custom
linestyle and modify
dash_capstyle.
Tips & tricks
You can adjust a colorbar’s
size when adding it.
You can use a condensed font
such as Roboto Condensed to
save space on tick labels.
Tips & tricks
Once your figure is finished, you can call tight_layout() to
remove white margins. If there are remaining margins, you
can use the pdfcrop utility (which comes with TeX live).
You can achieve a nice visual
effect with thick hatch patterns.
https://matplotlib.org/stable/users/index
Tips & tricks
S4-Matplotlib_Computational_Physics_.pdf

More Related Content

PPTX
Matplotlib.pptx for data analysis and visualization
PPTX
Introduction to matplotlib
PPTX
Matplotlib - Python Plotting Library Description
PPTX
Matplotlib yayyyyyyyyyyyyyin Python.pptx
PPTX
Unit3-v1-Plotting and Visualization.pptx
PDF
Matplotlib Review 2021
PDF
Matplotlib_Complete review_2021_abridged_version
PDF
Python matplotlib cheat_sheet
Matplotlib.pptx for data analysis and visualization
Introduction to matplotlib
Matplotlib - Python Plotting Library Description
Matplotlib yayyyyyyyyyyyyyin Python.pptx
Unit3-v1-Plotting and Visualization.pptx
Matplotlib Review 2021
Matplotlib_Complete review_2021_abridged_version
Python matplotlib cheat_sheet

Similar to S4-Matplotlib_Computational_Physics_.pdf (20)

PPTX
Introduction to Matplotlib Library in Python.pptx
PDF
Use the Matplotlib, Luke @ PyCon Taiwan 2012
PPTX
Unit III for data science engineering.pptx
PPTX
Introduction_to_Matplotlibpresenatration.pptx
PDF
711118749-FDS-UNIT-5-PPT.pdf is used to the engineering students
PDF
Matplotlib 簡介與使用
PPTX
Matplotlib-Python-Plotting-Library(Edited).pptx
PPTX
Introduction to Pylab and Matploitlib.
PPTX
matplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvf
PDF
Data Visualization using matplotlib
PPTX
MatplotLib.pptx
PPTX
UNIT-5-II IT-DATA VISUALIZATION TECHNIQUES
PPTX
Matplotlib.pptx
PDF
12-IP.pdf
PPTX
Python_Matplotlib_13. _Slides.pptx
PPTX
matplotlib _
PPTX
Matplotlib_Presentation jk jdjklskncncsjkk
PPTX
Python Visualization API Primersubplots
PDF
Introduction to plotting in Python
PPTX
UNIT_4_data visualization.pptx
Introduction to Matplotlib Library in Python.pptx
Use the Matplotlib, Luke @ PyCon Taiwan 2012
Unit III for data science engineering.pptx
Introduction_to_Matplotlibpresenatration.pptx
711118749-FDS-UNIT-5-PPT.pdf is used to the engineering students
Matplotlib 簡介與使用
Matplotlib-Python-Plotting-Library(Edited).pptx
Introduction to Pylab and Matploitlib.
matplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvf
Data Visualization using matplotlib
MatplotLib.pptx
UNIT-5-II IT-DATA VISUALIZATION TECHNIQUES
Matplotlib.pptx
12-IP.pdf
Python_Matplotlib_13. _Slides.pptx
matplotlib _
Matplotlib_Presentation jk jdjklskncncsjkk
Python Visualization API Primersubplots
Introduction to plotting in Python
UNIT_4_data visualization.pptx
Ad

Recently uploaded (20)

PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
RMMM.pdf make it easy to upload and study
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Lesson notes of climatology university.
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Cell Structure & Organelles in detailed.
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Presentation on HIE in infants and its manifestations
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Abdominal Access Techniques with Prof. Dr. R K Mishra
RMMM.pdf make it easy to upload and study
Microbial disease of the cardiovascular and lymphatic systems
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Lesson notes of climatology university.
Chinmaya Tiranga quiz Grand Finale.pdf
Cell Structure & Organelles in detailed.
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Presentation on HIE in infants and its manifestations
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Anesthesia in Laparoscopic Surgery in India
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Supply Chain Operations Speaking Notes -ICLT Program
Ad

S4-Matplotlib_Computational_Physics_.pdf