17. Python to make nice figures. Part III: advanced plots
Vložit
- čas přidán 4. 07. 2024
- This is part 3 in a 3-part series on making beautiful scientific figures in python. In this video, I will cover some advanced scientific plots in python.
Check out part 1 and part 2 if you haven't yet. Part 1: • 15. Python to make nic... Part 2: • 16. Python to make nic... All the files and scripts for these plots are available on the github github.com/sp8rks/MSE2001pyth...
00:00 Generic advanced plot
First, we cover the generic python script for making a nice figure.link: github.com/sp8rks/MSE2001pyth...
6:45 stacked plots with fill between
Next, we cover stacked plots with fill_between data setslink: github.com/sp8rks/MSE2001pyth...
11:51 multipanel plots
Next, we cover multipanel plots link: github.com/sp8rks/MSE2001pyth...
23:29 heatmaps
Next, we cover heatmaps using the seaborn library with 2D plots of the end memberslink: github.com/sp8rks/MSE2001pyth...
37:24 multiple axes plots
Next, we cover figures with multiple axes link: github.com/sp8rks/MSE2001pyth...
44:32 Rietveld refinement diffraction plots
Next, we cover Rietveld refinement diffraction plotslink: github.com/sp8rks/MSE2001pyth...
51:24 3D plots
Finally, we cover 3D plots with contour, surface, and scatter plotslink: github.com/sp8rks/MSE2001pyth... - Hry
From zero to be able to perform nice figures on python, thanks to you. Continue like this!!
It's my pleasure! What else would be helpful??
@@TaylorSparks I think a video going through a complex big data managing task, together with representing it in 3D, would be very very useful for us. Perhaps with some complex numpy and pandas functions in it. I would definitely pay for that! Hehe
My sincere compliments on your superb video. Lots of helpful coding tips to move programmers to a higher level, plus no annoying background music.
Thanks homie!!
Excellent work!
Super helpful tips! Love it
Thank you for these very useful videos!
So helpful for people who want to switch from R to Python. Awsome.
It would be really helpful if you have some time someday to make a video for common statistical tests: Two tailed unpaired or paired t test, mann-whitney, wilcoxon test, anova test, repeated measures anova ?
thank you Taylor! these 3 videos were super useful for me
Awesome! Go make some killer plots!
Excellent tutorial. Thank you so much.
So glad to help
jeez I'm only a third of the way through and already learnt lots of new meaty goodness. I love that iloc trick about returning every nth value (I can't even find that in the documentation). And the gridspec is new to me as are the text() methods on graphs. And also getting the colours out of SNS palettes.
I've dipped my toes into seaborn and others but I don't really like over fancy graphs and I feel it's important to get fluent with the basics - matplotlib - before going mad with plotly and dash
Look forward to watching the rest
Heck yeah. Start cranking out some beauties!
You are great !! Many thanks.
Great video! Fantastic resource
Heck ya!
Very nice video. Thank you so much!
Glad to help!!
Could you make a volume plot to add a dimension to the surface plot? For example if you wanted to show how 3 input varibles make an output.
Thanks for the amazing series on plotting!
The following 2 lines address the issue mentioned at 43:53
twin1.spines["right"].set_edgecolor(p2.get_color())
twin2.spines["right"].set_edgecolor(p3.get_color())
oh my gosh. That saved me so much pain!! You are the best. Thanks for the tip and thanks for watching!
one slight fix to make it work with my code
par1.spines["right"].set_edgecolor(p2.get_color())
par2.spines["right"].set_edgecolor(p3.get_color())
I've updated the github files for this code to reflect this helpful change. Thanks again!
Can you please plot the different range with percentage graph? For eg. You can see tidal deformation plot in neutron star merger
Cool tutorial!
Though I fail to see any difference in your heatmap with a heat map directly on df.loc[504:4066,'y1':]**(1/1e5)
I also fail to see any reason to separate the variables. x1, y1 to y21
but maybe I'm missing something ?
You can rename the columns by
pressure[:0] = df.columns[0] # prepends the column name 'Q' to pressure list
df.columns = pressure
if one really wanted to fix the data to more tidy format one can
pd.melt(df, id_vars='Q',var_name='Pressure (GPa)', value_name= 'Intensity')
Full steam ahead on the python lectures, i may have to cite you on my research paper lol
Lol. So glad it's helpful!
Hello Taylor, i would like to know if there is a way to smoothen the aspect of the surface plot instead of getting a mesh like surface ? I am working on a hardness cartography and i dont have a lot of data points so i need the figure to be smoother in a way we can get a nice extrapolated colors between the points. thank you in advance
Thanks a lot for the nice videos. I wonder about how to merge additional axes in contour plots as in the figure below?
Merge additional axes?
Great video thank u!!!!! Maybe would be nice to have ternary diagram with heatmapping or contour :)
Ooh cool idea!
Nive video. Do you how to produce similar plots using a vtk file with fem calculix results from freecad as a source? Could you point me in some website with info about this?
Never heard of them.
I need to admit once more that you are one the greatest people I've ever known (at least virtually) on this earth. Thank God bring so lovely and dedicated people like you to share their knowledge in a way that is so easy and exciting to learn. I really find a role model in you and the way how you teach. In November, I got a position to start my Ph.D. in Germany on a topic related to Ceramics (Mxenes and 3d printing) and two of the reasons why I decided to do it were my passion for teaching ( I wish I could someday teach as nice as you do) and the great world of materials helped by informatics just waiting for us.
Thank you so much again, amigo Taylor from another human being just following his passion and finding incredible (virtual) mentors like you.
post data. I just started to see the list of videos about ceramics, unfortunately, some of them are "hidden" on CZcams. It would be more than great if there would be a form to have access to them. I also understand if it is not possible.
Gracias por todo y mucho éxito en Inglaterra!
I add my email if it is possible to send me the links for the YT ceramic videos :D! fernando.floressuarez@student.uni-augsburg.de
Thank you so so much for the kind words! I actually started making CZcams videos when I was teaching my ceramics course. I was pretty new to it and the quality and completeness isnt quite great. I plan on redoing them at some point so they are higher quality