{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n\n# Plotting with Configurations in `pyprocar`\n\nThis example illustrates how to utilize various configurations for plotting the density of states (DOS) using the `pyprocar` package. It provides a structured way to explore and demonstrate different configurations for the `dosplot` function.\n\n## Preparation\nBefore diving into plotting, we need to download the example files. Use the following code to do this. Once downloaded, specify the `data_dir` to point to the location of the downloaded data.\n\n.. code-block::\n   :caption: Downloading example\n\n    import pyprocar\n\n    data_dir = pyprocar.download_example(\n                                save_dir='', \n                                material='Fe',\n                                code='vasp', \n                                spin_calc_type='spin-polarized-colinear',\n                                calc_type='dos'\n                               )\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import os\n\nimport pyprocar\n\n# Define the directory containing the example data\ncode = \"vasp\"\ndata_dir = os.path.join(\n    pyprocar.utils.DATA_DIR, \"examples\", \"Fe\", code, \"spin-polarized-colinear\", \"dos\"\n)\n\nspins = [0, 1]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Section 1: Locating and Printing Configuration Files\n# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n#\n# This section demonstrates where the configuration files are located in the package.\n# It also shows how to print the configurations by setting print_plot_opts=True.\n#\n\n# Path to the configuration files in the package\nconfig_path = os.path.join(pyprocar.__path__[0], \"cfg\")\nprint(f\"Configuration files are located at: {config_path}\")\n\n# Print the configurations\npyprocar.dosplot(code=code, dirname=data_dir, fermi=5.599480, print_plot_opts=True)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Section 2: Changing cmap, clim, and Fermi line properties\n# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n#\n# This section demonstrates how to change the colormap (cmap), color limits (clim),\n# and Fermi line properties (color, linestyle, and linewidth).\n#\n\npyprocar.dosplot(\n    code=code,\n    dirname=data_dir,\n    fermi=5.599480,\n    atoms=[0],\n    orbitals=[4, 5, 6, 7, 8],\n    mode=\"parametric\",\n    cmap=\"viridis\",  # Colormap\n    clim=[0, 1],  # Color limits\n    fermi_color=\"red\",  # Fermi line color\n    fermi_linestyle=\"--\",  # Fermi line linestyle\n    fermi_linewidth=2.0,  # Fermi line linewidth\n)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Section 4: Setting the Figure Size and DPI\n# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n#\n# This section demonstrates how to set the figure size and dots per inch (DPI) for the plot.\n#\n\npyprocar.dosplot(\n    code=code,\n    dirname=data_dir,\n    fermi=5.599480,\n    atoms=[0],\n    orbitals=[4, 5, 6, 7, 8],\n    mode=\"parametric_line\",\n    clim=[0, 1],\n    figure_size=(10, 6),  # Figure size (width, height)\n    dpi=300,  # Dots per inch\n    grid=True,  # Boolean for grid\n)"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.9.20"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}