Тёмный

How I make beautiful GRAPHS and PLOTS using LaTeX 

Dr. Trefor Bazett
Подписаться 414 тыс.
Просмотров 439 тыс.
50% 1

Get started with LaTeX using Overleaf: ► www.overleaf.com/?.... My thanks to Overleaf for sponsoring today's video.
Check out the previous videos in my LaTeX playlist:
► • LaTeX Tutorials
I make most of my graph and plots inside of LaTeX using a package called pgfplots. LaTeX is a type setting language and I like using it for graphs specifically because I can control all aspects of my graphs very precisely, with formatting native and easily adjustable with the rest of my document, with syntax similar to the syntax of the rest of LaTeX that I use all the time, and best of all it is free and will remain readily available. In this video we will see how to do 2D graphs, scatter plots, bar charts, 3D surface plots and 3D line plots, as well as how to format all aspects of our plots and axes.
0:00 Why I use LaTeX and pgfplots for plots and graphs
1:17 Why I use Overleaf as my LaTeX editor
2:00 The simplest 2D plot
3:57 Adjusting the preamble
4:49 Customizing plot color, style, marks, samples
6:25 Adjusting axis bounds, placement, labels and title
9:04 Plot domain
9:45 2nd example: ticks, tick labels, grid lines
13:51 Adding text nodes
15:18 3rd example: Scatter plot with imported data
18:38 4th example: color coded scatter plot
20:16 5th example: stacked bar chart
21:23 Version history in overleaf
22:00 6th example: 3D surface and mesh plots
25:47 7th example: 3D curve plot
The full documention for pgfplots (it's long!) is here: www.iro.umontreal.ca/~simardr...
Check out my MATH MERCH line in collaboration with Beautiful Equations
►beautifulequations.net/pages/...
COURSE PLAYLISTS:
►DISCRETE MATH: • Discrete Math (Full Co...
►LINEAR ALGEBRA: • Linear Algebra (Full C...
►CALCULUS I: • Calculus I (Limits, De...
► CALCULUS II: • Calculus II (Integrati...
►MULTIVARIABLE CALCULUS (Calc III): • Calculus III: Multivar...
►VECTOR CALCULUS (Calc IV) • Calculus IV: Vector Ca...
►DIFFERENTIAL EQUATIONS: • Ordinary Differential ...
►LAPLACE TRANSFORM: • Laplace Transforms and...
►GAME THEORY: • Game Theory
OTHER PLAYLISTS:
► Learning Math Series
• 5 Tips To Make Math Pr...
►Cool Math Series:
• Cool Math Series
BECOME A MEMBER:
►Join: / @drtrefor
SOCIALS:
►Twitter (math based): / treforbazett
►Instagram (photography based): / treforphotography

Опубликовано:

 

26 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 295   
@Filup
@Filup 2 года назад
Very good video. I am a double degree student in math and comp sci, and LaTeX is one of those things that you both remember but never entirely. Having a whole video with dedicated examples is a good reference for anyone who cannot quite recall how to do individual tasks. This is a better resource than the online forums recommending (and I do not joke) 20+ year old advice, which may now me deprecated.
@stevematson4808
@stevematson4808 2 года назад
Years ago I helped develop the Latex language -- When I worked for Vandelay Industries.
@comporellon
@comporellon 9 месяцев назад
Founded by Art Vandelay?
@stevematson4808
@stevematson4808 9 месяцев назад
@@comporellon Yes, he was a good friend of mine. Did you know him too?
@Arycke
@Arycke 8 месяцев назад
​@comporellon don't forget Don Knuth, creator of TeX also! LaTeX is amazing
@stevematson4808
@stevematson4808 8 месяцев назад
@@Arycke oh yes, good ol Don. Don was on my bowling league.
@Arycke
@Arycke 8 месяцев назад
@stevematson4808 thank you for your development of LateX sir I appreciate your contribution.
@Childerick1
@Childerick1 Год назад
It is so nice to have a well articulated tutorial on Latex at the right speed and with a well presented screen. Plus the enthusiastic smile of the lecturer who carries so much positive emotions. Thanks a lot!
@the-alchemist13
@the-alchemist13 2 года назад
It was a nice surprise to see that many of the commands are quite similar to MATLAB’s or Matplotlib’s plotting and formatting environment commands
@fgp1979
@fgp1979 2 года назад
Other way around I believe: the commands in Matlab and matplotlib are similar to latex's!
@youerny
@youerny 2 года назад
The root of those API are from Matlab, but they are so simple and widely used that introduces something totally different would just consume precious time to learn again. Still, as a new user of Python and all the most widely adopted libraries, I must confess that the “anatomy of a figure” in matplotlib is still a bit confusing when compared to Matlab’s. I spent many years before switching, but still not everything is straightforward to me. And mixing NP or PD with matplotlib is nice, but introduces some peculiarities for each data substrate that could be made more uniform. I am referring to syntax for a plot, vs a plot from a dataframe, vs a plot from a np.math array. Small differences are disorienting and matlab is more straightforward. But it is free, as a beer in a drunk speech, therefore thanks to the community for sharing it all with us
@d029w7
@d029w7 2 года назад
A new LaTeX user here. This video is very helpful. I am going to check other videos as well. Thank you for sharing your knowledge.
@bluedoggo4429
@bluedoggo4429 2 года назад
bruh, I've been waiting for this video soooo much. Grazie mille! *thankful italian gestures*
@bastianfrom77
@bastianfrom77 8 месяцев назад
In the "old days" I used gnuplot which produces either eps, png or latex-code. It is actually a old, (then) convinient tool. One of the main points for me was, that the plots have a common style and not look too different. Another important feature was, that als the labels in the graph have exactly the same font and adapted fontsize as found in the text. I like this package you presented here and I think I will try it
@haraldurkarlsson1147
@haraldurkarlsson1147 2 года назад
Nice presentation and I agree you cannot simply watch this stuff. You have to do it yourself in order to learn it. LaTeX does have steep learning curve but the habits you develop when working with it will help when working with other programs. Fortunately, the PGFPLOTS manual is excellent with great examples and explanations. Finally, it is simplest to set compat=newest inside the pgfplotsset (in the preamble) and not worry about the version you are using. I would like to see more on working with external data - for instance csv files. Thanks.
@SourabhBhat
@SourabhBhat 2 года назад
I generally use matplotlib (Python library) with TeX fonts for plotting and export as pdf or eps for later adding to my LaTeX document. Even though it produces very high quality plots, I have to manually adjust the font size (using trial & error) to match the document font size. Pgfplots seems wonderful to get the best of both worlds, especially with the external data file option. Thank you !
@FranseFrikandel
@FranseFrikandel 8 месяцев назад
I believe if you just set the figure size correctly in matplotlib, and then don't add any width settings or similar to your includefigure in LaTeX, the font sizes should translate correctly.
@ppal64
@ppal64 2 года назад
LaTeX is just something that physicists ‘do’,” explains chief editor ( Nature Magazine) Andrea Taroni. “Trying to get them to do otherwise is like trying to herd cats.”
@tiagoinenglish
@tiagoinenglish 4 месяца назад
Thank you so much, Mr. Bazett! I didn't even know it was possible do graphics on LaTeX. I've just learnt something new! It was pretty exciting. I hope I can do the graphs I need to do
@FelipeBalbi
@FelipeBalbi 2 года назад
11:58 the way I consider the anchors is that I place a bounding box around the label, then the point on that bound box that sits on the axis is the (in this case) the south west corner of the bounding box
@fredericoamigo
@fredericoamigo 2 года назад
Dude, your content is a goldmine for me as an aspiring Data scientist. Another brilliant video!
@DrTrefor
@DrTrefor 2 года назад
Thank you!
@rayenwiller
@rayenwiller 7 дней назад
it's lucky to learn from a wonderful teacher.
@mikefochtman7164
@mikefochtman7164 2 года назад
As an older person, when I went back to take some college for an additional degree (~2010), I struggled with coming up with graphing tools like this. I wish I had found your material then but it may not have existed, I don't know. I ended up kluging some stuff together with Excel and what-not. (first round of school, we typed papers on typewriter and left large blanks, where we would hand-write formula/ symbols. lol) Love your videos, even if I don't have a big use for them now (retired). Some folks might not appreciate how nice these tools are. (okay, I'm being curmudgeonly, "kids don't know how good they have it, we had to walk... uphill both ways... ", "You had ones and zeros? We programmed with only ones!" lol)
@antoniocafualicamendes2370
@antoniocafualicamendes2370 Год назад
Salvaste a minha tese. Muito obrigado pela aula linda e clara!
@ziedjbeli4811
@ziedjbeli4811 2 года назад
Very helpful, thank you so much!
@DrWeselcouch
@DrWeselcouch 8 месяцев назад
This is great! I use Tex all the time, but now I'll be able to make graphs with Absolute Confidence!
@solarflair3613
@solarflair3613 2 года назад
Those 3d plots look so sick !!!! Great stuff very cool
@fadl999
@fadl999 2 года назад
Thanks a lot for the video and sharing the latex template.
@rogeriosoares8272
@rogeriosoares8272 2 года назад
Very helpful. Thank you for the video
@zahidurrahaman428
@zahidurrahaman428 Год назад
Very good job. Thank you very much Dr. Trefor.
@DrTrefor
@DrTrefor Год назад
Glad you liked it!
@sg6280
@sg6280 3 месяца назад
Thank you! This was extremely helpful and well done!
@alialzahrani1541
@alialzahrani1541 Год назад
Your video has made my life much easier.. thanks a lot 💐
@angelamusiemangela
@angelamusiemangela 7 месяцев назад
Che bello!!!!! Il punto centrale,nel cerchio e nella circonferenza!!!!! Whaooo!
@FelipeBalbi
@FelipeBalbi 2 года назад
Very cool! I wish I had this video years ago when I started using latex and tikz. Personally, I like to put tikzpicture always inside a figure environment that starts with a \centering :-)
@user-uy8yt7ku4w
@user-uy8yt7ku4w 2 года назад
Thank you for this amasing video! Although I prefer to plot in matplotlib in my Jupyter notebook and then import pgf plot to Latex. It's more convenient if you're doing some calculations on the data before plotting it and might want to change source of the data/add some other calculations.
@keysersoze_6
@keysersoze_6 2 года назад
Mate, you helped me a lot, i had to make loads of plots for my thesis!
@janstoeb
@janstoeb 2 года назад
I studied Electrical Engineering in Lübeck, Germany, where the creator of TikZ Till Tantau teaches as a Professor :D
@stephenpaapaowereduassefua5371
@stephenpaapaowereduassefua5371 2 года назад
This video is really useful. Thanks a lot sir
@jonathanalexandremorazalme7495
Very nice video! Thank you for the content!
@NuclearPhysix
@NuclearPhysix 2 года назад
I wish I had just 1 percent of your brains. Great work Dr Bazett.
@DrTrefor
@DrTrefor 2 года назад
You do!
@ImStian
@ImStian 8 месяцев назад
Fantastic video! I'm writing my bachelor's thesis next semester it's going to look super fancy with these plots! :D
@pedrogonzalobrito
@pedrogonzalobrito Год назад
Thank you very much! Excellent video 💯
@user-hv9hm8uz3i
@user-hv9hm8uz3i 4 месяца назад
Thank you very much! Excellent video
@meu22422
@meu22422 2 года назад
I use Matlab to plot and then adjust its formating and styles etc using its plot editing tool. Then save it as .eps file and load into latex. Crisp looking graphs but as you said, symbols and fonts are not same as latex maths. But as long as it is consistent for all plots, it's ok.
@TranquilSeaOfMath
@TranquilSeaOfMath 2 года назад
This is a nice overview/introduction to pgfplots.
@sergiop.4909
@sergiop.4909 2 года назад
Very helpful thanks!! Plotting with this package looks easier than plotting on matlab or octave haha
@hrperformance
@hrperformance 2 года назад
Whoohooo! This is going to be so useful!! (I haven't actually watched it yet but I know it will be good haha)
@abdellahmrij4112
@abdellahmrij4112 4 месяца назад
Amazing courses excellent continuation
@JR-uc3nk
@JR-uc3nk 14 дней назад
Hey dude I love you with all my heart you have so many important videos that help me haha
@erikfauser2418
@erikfauser2418 Год назад
very helpful video and easy to understand
@Eligos666
@Eligos666 2 года назад
I love it!
@noblesavage149
@noblesavage149 2 года назад
Looking forward to having a go with this in emacs!!!
@leonardosouzaconradodesant6213
Thank you for share!!!
@jacobstarr9010
@jacobstarr9010 5 месяцев назад
I'm in a physics lab and am trying to learn LaTeX to make it easier to make good lab reports, so thank you for these videos
@simonbenitezsoto9606
@simonbenitezsoto9606 7 месяцев назад
Great video!
@soufianehn8817
@soufianehn8817 Год назад
Just Amazed by all informations contained by Latex...Too Much Thanks For You Dr Trefor for all the explanations and the interesting Tutorials about OverLeaf..
@yolamontalvan9502
@yolamontalvan9502 2 года назад
This is really amazing. I was learning PostScript with GhostScript because I have a PostScript printer. But this Latex seems to be more powerful for making graphics. Thanks.
@Bobbias
@Bobbias 2 года назад
Iirc LaTeX often gets compiled to postscript in a lot of cases.
@youerny
@youerny 2 года назад
I truly respect you for the effort of learning PS (!!) in 202x. Please make you a favor and go some steps upwards: ps is to docs as assembly is to programming. You can do it, but it almost always not needed today. One more layer of indirection could be useful, automating LaTeX generation by means of python and running it from data at compile time -if needed-.
@whydoyouaskdude
@whydoyouaskdude 2 года назад
Nice video. You don't need to specify color=red, just [red] will do the same. Also, did you know a node can contain literally anything? Even includegraphics commands to position images with nodes or even entire tikzpicture environments to reuse and easily move entire already made TikZ graphics. The possibilities are endless.
@chesshooligan1282
@chesshooligan1282 6 месяцев назад
Thank you for this.
@zyxzevn
@zyxzevn 2 года назад
And I thought that Latex was just for plain text and formulas. Thanks for showing this.
@kalinaszek
@kalinaszek 2 года назад
I love overleaf!
@youerny
@youerny 2 года назад
Many packages available, but after several docs I definitely opted for matplotlib+pdf despite coding the plots in the doc src. As far as I know I just opted for a control flow design package because the quality of the feedback control loops were astonishing. LaTeX should be mandatory, but try to look for the best compromise among orthodox approach and throughput (how long it takes to complete this chapter, one week or three?). :)
@youerny
@youerny 2 года назад
@gautha pandith every task, its tool. I totally agree with you. On the other hand we should consider with huge humility that the author of TeX is a genius, and definitely not someone prone to adopt efficient trade-offs like both of us. The effort to write such an intricate piece of SW, after having studied editor graphics and Fonts deeply, in order to write the most wide and beautiful books (encyclopedia today…?) about Computer Science, just because his publisher changed the font for his books with something he disliked, is not exactly the average scientist aiming at publishing to avoid death :). Jokes aside, thank you with all my gratitude, Dr Knuth and Dr. Lamport, for making the world a better place with your creations (La)TeX!
@aweebthatlovesmath4220
@aweebthatlovesmath4220 2 года назад
Love the shirt!
@DrTrefor
@DrTrefor 2 года назад
Thanks! It is one of my favourites:D
@michaelgraff6978
@michaelgraff6978 2 года назад
I knew TeX and LaTeX very very well when I was in college. I now have flashbacks.
@isaackay5887
@isaackay5887 2 года назад
I'd love to see a video on using LaTeX to create graphs for solutions of inhomogeneous diffusion- / wave- equation BVPs (especially ones who's spatial operators are not self-adjoint - requiring to be put into Sturm-Liouville form) [Edit 1: I think it would be helpful to know how to do this here in LaTeX versus using secondary software like MATLAB, Python, Wolfram, or Geogebra, especially for lecture documentation purposes when trying to compare what would happen with different ICs and variations of dirichlet/neumann/robin BCs. By the way, love your videos, Dr. Bazett - keep up the terrific work!] [Edit 2: Ahh shoot - I had too much hope! It's such a powerful tool that sometimes I forget it's not an IDE 😅]
@DrTrefor
@DrTrefor 2 года назад
So LaTeX doesn't "know" any math, it doesn't know how to solve a differential equation for instance. So that part I have to leave to you, but once you have a function or a vector field or whatever else, then LaTeX can be used to plot it.
@ocayaro
@ocayaro 2 года назад
This video finally made me subscribe.
@taghreednaser1886
@taghreednaser1886 2 года назад
That is great☆ ..thank you
@MrRenanwill
@MrRenanwill 2 года назад
I like to use SVG figures generated by Geogebra. The time it compiles is just larger in the first time you compile it. In the rest of the time, It looks like the time of inserting a PDF.
@oriontechtube
@oriontechtube 2 года назад
very important video !
@GhulamNabiDar
@GhulamNabiDar Год назад
Your vedios indeed great and greatest
@porthos892
@porthos892 2 года назад
Very good and informative playlist of LaTex!!! Could you show also watermarks imports and images configurations. Like, how I could put the images accurately where i want..... Thanks for all your help!!!! awesome job!!!!!! 🔥🔥
@davidgillies620
@davidgillies620 2 года назад
A big advantage of LaTeX is that it is programmatically generable in a way that, say, MS Word documents are not (you can script Word using Visual Studio, but you probably shouldn't). For stereotyped report creation, for example, it's a very lightweight technique. I primarily use Mathematica to generate plots for inclusion in LaTeX documents because I have even more control over the output , as well as three decades' experience using the software. Lately I've been using R quite a bit.
@youerny
@youerny 2 года назад
MS word is for administrative staff. If your job is different, LaTeX is your tool! Possible in one of the modern online incarnations
@mathed6054
@mathed6054 2 года назад
very helpful .. Thanksssssssssss
@dxrbkn5145
@dxrbkn5145 2 года назад
this will be useful later nice thanks
@NuclearPhysix
@NuclearPhysix 2 года назад
I admire your knowledge and clarity of explanations. Can I request/suggest a series on the history of famous mathematical functions such as Laplace, Gamma, Fourier, etc. How did they come about?
@DrTrefor
@DrTrefor 2 года назад
That's a great idea!
@mameemia
@mameemia 2 года назад
@@DrTrefor thank you for your great effort !!!!!!!
@gustavosanezchancy3194
@gustavosanezchancy3194 9 месяцев назад
Take my like. What an interesting video.
@drsumankhanal
@drsumankhanal 2 года назад
Hi, thank you for the video. If you have time, could you please also teach on how to write latex class and latex packages: from basic to advanced?
@emanuelorzusa
@emanuelorzusa 2 года назад
¡Gracias!
@thabsor
@thabsor Год назад
thank you very much
@vin84iitr
@vin84iitr 2 года назад
Awesome video!! Adding a small request to demonstrate overleaf to use in journal article submission (preferably for Elsevier).
@FoxtwoPC
@FoxtwoPC 2 года назад
Thank you for a fantastically explained and generally helpful video -- I only wish it existed or I was aware of these tools when I wrote my thesis in 2011 using LaTeX and a DIY MATLAB/Octave/Bash script set that would sequentially run Matlab/Octave scripts to generate, label, export plots into a graphics folder and then compile my LaTeX doc where they would be added using '\includegraphics' then ->pdfLaTeX->open in some Ubuntu pdf viewer to create my "instant" preview...something like pgfplots would have helped me close the loop in a much simpler manner...I think at the time I was just happy that I got BibTex working...
@Serenesium
@Serenesium 2 месяца назад
1:18 Is no one going to mention how perfect the sponsorship segment is?
@ketantamhankar3620
@ketantamhankar3620 Год назад
Hi! How would you plot an implicitly defined function on 2D axes? Also, if you want to highlight a specific point on a graph, how would you go about doing it?
@saragalvan1159
@saragalvan1159 2 года назад
I love latex, when overleaf started I really hate it! To me share Latex was heaven. But when they merge the two projects, I was forced to use overleaf and now I recognize that is really useful and I love the project! God bless you guys!
@muzaffarbashir4566
@muzaffarbashir4566 Год назад
Love you dr sb ❤
@RiadhBoukratem
@RiadhBoukratem Год назад
Perfect presentation👏 Is there a package or solution in LaTex that allow us, to calculate and graph the logarithmic integral function?
@jasonthomas2908
@jasonthomas2908 Год назад
I use Jupyter Notebooks + Gnu Octave. That way I can do computation stuff alongside my latex
@oidbio2565
@oidbio2565 2 года назад
Excellent video. Thank you! I was wondering if you do any videos on producing a video…a meta-training so to speak :). If not, would you mind letting us know what editing tools you use. I have been teaching online regularly and and have been using the standard recording features of zoom but I can’t edit at all. I know I can download the videos and edit them in another app but so far have not attempted to do this. Do you record and edit in the same app? Thank you for any recommendations you have time to share with me!
@DrTrefor
@DrTrefor 2 года назад
I have this video!!! ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-hmQd_P_qj1w.html
@rafrakesp8529
@rafrakesp8529 2 года назад
I really appreciate this kind of videos, thank you so much! I want to go deeper and learn all the posibilities for customizing my graphs, i.e. fontsize, labels and title location, etc... Is there any recommendation for that?
@user-he4ef9br7z
@user-he4ef9br7z 2 года назад
Read the package manual from CTAN.
@valentin0000
@valentin0000 2 года назад
I always use python's matplotlib and then include the eps-file in LaTeX :)
@AhmetFrk347
@AhmetFrk347 2 года назад
Dr. Bazett, are there any way to decrease pdf file size in LaTex. I am working on a 25 page document which has about 20 eps formatted figure. I use textmaker and the compiled pdf is 92 mb.
@leonardomiraanda1280
@leonardomiraanda1280 8 месяцев назад
very good
@audic2350
@audic2350 2 года назад
I usually use gnuplot to plot graphs and then I screen it to my latex files... I think using your method is better
@s.l.2879
@s.l.2879 2 года назад
Hey, I have been using tikz and pgfplot for a while now, but there is always something new to learn from your videos. Awesome! Using tikz for my plots is just so much better. No more pain with different fonts, fontsize etc. when including plots from other programs. Something worth mentioning is the externalize library, which helps with the long compilation times, especially when you are including experimental data or you just have a lot of figures , in overleaf you can get a compilation timeout really quick. One question of topic: I watched your video where you presented your own thesis and I really liked the font you were using. Do you remember which one it was and how to use it?
@DrTrefor
@DrTrefor 2 года назад
Thank you and yes that is a very good trick with lots of plots! I don’t recall the font, but if you load the university of Toronto template it will be whatever it uses
@Linuxdirk
@Linuxdirk 8 месяцев назад
I really wish I had an actual use for LaTeX in my daily hobby or work life!
@muzaffarbashir4566
@muzaffarbashir4566 Год назад
Plz do share your old overleaf project so we can learn more
@mfmcampos
@mfmcampos 9 месяцев назад
Really nice video!! Congrats! Which software do you use do record your presentations? Thanks!
@samuelnewport4970
@samuelnewport4970 2 года назад
Great video, would be really useful to have access to the document code for quick reference
@OlafurViir
@OlafurViir Год назад
Do you know if the table needs to be formatted in a certain way? Really want to use this method while writing my thesis. So far only getting errors, and I haven't found anything concreate on external data in the docs.
@jaikanthp5924
@jaikanthp5924 2 года назад
Sir, please make video on Interactive PDF using LATEX.
@MukkuPavanKumarPHD
@MukkuPavanKumarPHD 2 года назад
Thank you so much, sir. Can u suggest to me how to add a label to the axis?
@DrTrefor
@DrTrefor 2 года назад
xlabel={} and ylabel={}
@motherisape
@motherisape 2 года назад
Cool .
@ponsianoodongkara2473
@ponsianoodongkara2473 2 года назад
Hello Dr Trefor, I thanks for your latex videos, I have learnt to use latex just from. I keep getting this error of white space during citations and I don’t know how to work on it, how can I fix it thanks
@vicentesepulvedatrivelli5843
great video, but i have a question, how can i plot a vector field with pgfplots? or do i have tu use other package?
@JohnVKaravitis
@JohnVKaravitis 2 года назад
Jesus Christ. 3 minutes into this video, and I'm already exhausted looking at all this code!
@DrTrefor
@DrTrefor 2 года назад
haha! I thought this the first time too!
@syedshahfahd2659
@syedshahfahd2659 Год назад
I want to use alphanumeric characters in the x-axis for a graph, but whenever I try to punch the alphanumeric characters in the x-axis coordinate, it shows errors. Can you help in this regard?
@chispun2
@chispun2 2 года назад
How do you plot several txt datapoints in the same graph? Each of them connected as if a function, for example