software:matplotlib:matplotlib

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
software:matplotlib:matplotlib [2024-02-19 16:19] – [Using LaTeX in plot text] anitasoftware:matplotlib:matplotlib [2024-02-20 10:30] (current) – [Matplotlib] anita
Line 5: Line 5:
 Matplotlib, pylab and pyplot are all related.  Matplotlib is the whole package; pylab is a module in matplotlib that gets installed alongside [[http://matplotlib.org/api/matplotlib_configuration_api.html#module-matplotlib|matplotlib]]; and [[http://matplotlib.org/api/pyplot_api.html#module-matplotlib.pyplot|matplotlib.pyplot]] is a module in matplotlib. There is a [[http://matplotlib.org/users/pyplot_tutorial.html|pyplot tutorial]] and numerous other sites that use matplotlib for their plot examples such as [[http://www.scipy.org/Cookbook/Matplotlib/|SciPy Cookbook for Matplotlib]]. Matplotlib, pylab and pyplot are all related.  Matplotlib is the whole package; pylab is a module in matplotlib that gets installed alongside [[http://matplotlib.org/api/matplotlib_configuration_api.html#module-matplotlib|matplotlib]]; and [[http://matplotlib.org/api/pyplot_api.html#module-matplotlib.pyplot|matplotlib.pyplot]] is a module in matplotlib. There is a [[http://matplotlib.org/users/pyplot_tutorial.html|pyplot tutorial]] and numerous other sites that use matplotlib for their plot examples such as [[http://www.scipy.org/Cookbook/Matplotlib/|SciPy Cookbook for Matplotlib]].
  
 +<note tip>These directions are geared towards setting up and running Matplotlib on Caviness. However these directions can easily be used on DARWIN, although references to directory paths and software versions may be different.</note>
 ===== Interactive job ===== ===== Interactive job =====
  
-All interactive jobs should be run on a compute node by setting your ''workgroup'' and using ''salloc''. You need to be running X-Windows and you should make sure you are in the directory where your input and output files will be stored.  In the example below, we are using the ''traine'' account in workgroup ''it-css'' to create the ''plot123.png'' file using Python packages Matplotlib.+All interactive jobs should be run on a compute node by setting your ''workgroup'' and using ''salloc'' and the proper X11 settings since you need to be running X-Windows to produce graphics. Also make sure you are in the directory where your input and output files will be stored.  In the example below, we are using the ''traine'' account in workgroup ''it-css'' to create the ''plot123.png'' file using Python packages Matplotlib and using the Intel version of Python since it comes with the packages we need without having to create our own Python virtual environment.
  
 <code bash> <code bash>
Line 59: Line 60:
 </code> </code>
    
-Now we can use this python plot example file and run it using a basic serial job script.  Copy the job script template from ''/opt/shared/templates/slurm/generic/serial.qs'' and call it ''serial-plot.qs''. Modify ''serial-plot.qs'' to set the correct partition, add the correct ''vpkg_require intel-python'' and replace ''srun date'' with ''python plot-ex.py''.+Now we can use this Python plot example file and run it using a basic serial job script.  Copy the job script template from ''/opt/shared/templates/slurm/generic/serial.qs'' and call it ''serial-plot.qs''. Modify ''serial-plot.qs'' to set the correct partition, add the correct packages with VALET ''vpkg_require intel-python'' and replace ''srun date'' with ''python plot-ex.py''. Remember ''_workgroup_'' can be used for the partition because in order to submit jobs, the workgroup must be set using the ''workgroup'' command, so whatever workgroup has been set will be substituted in for ''_workgroup'' This allows our job scripts to be more flexible when you have more than one workgroup on the cluster.
    
 <code - serial-plot.qs> <code - serial-plot.qs>
Line 99: Line 100:
 ==== View plots with Imagemagick ==== ==== View plots with Imagemagick ====
  
-If you want to review the plots created, then you can use Imagemagick on the compute nodes via qlogin as long as you are running X-Windows. For example, using account ''traine'' and workgroup ''it_css'', we display the ''plot-cs.png'' plot file. +If you want to review the plots created, then you can use Imagemagick on the compute nodes via ''salloc'' with the proper X11 options and you are running X-Windows. For example, using account ''traine'' and workgroup ''it_css'', we display the ''plot-cs.png'' plot file. 
    
 <code bash> <code bash>
Line 143: Line 144:
 </code> </code>
  
-Using a basic serial job script like ''serial-plot.qs'' copy it and make changes below, then use ''sbatch serial-plot-latex.qs'' will create the plot file ''latex_demo.png'' in the current working directory where you submitted the job.+Using a basic serial job script like ''serial-plot.qs'' copy it and make changes below to set the partition, include the appropriate VALET packages and the command to run Python, then use ''sbatch serial-plot-latex.qs'' to submit the job. This job will create the plot file ''latex_demo.png'' in the current working directory where you submitted the job.
  
 <code - serial-plot-latex.qs> <code - serial-plot-latex.qs>
Line 157: Line 158:
 # #
 #vpkg_require intel/2019 #vpkg_require intel/2019
-vpkg_require intel-python+vpkg_require intel-python texlive
  
 # #
  • software/matplotlib/matplotlib.1708377597.txt.gz
  • Last modified: 2024-02-19 16:19
  • by anita