---
title: "Plotting"
slug: "plotting"
updated: 2025-04-02T21:35:00Z
published: 2025-04-02T21:35:00Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.imat.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Plotting

Pandas uses MatPlotLib to do its visualization but simplifies many common issues found with MatPlotLib. In most cases, Pandas meets graphing needs. However, if deep customizations are needed, it is necessary to use MatPlotLib. See [pandas.pydata.org](http://pandas.pydata.org/pandas-docs/stable/visualization.html) or [matplotlib.org](http://matplotlib.org) for more detailed information on Pandas plotting.

The query and table below are used for reference points on all graphs displayed in this document.

#### Query:

```python
dataframe = get_hits('()diabetes', store='Records', limit=5, fields='extract.patient_id, extract.age,  extract.patient_full_name, extract.weight_standard')
print(dataframe)
```

#### Response:

|  | extract.age | extract.patient_full_name | extract.patient_id | extract.weight_standard |
| --- | --- | --- | --- | --- |
| 0 | 43 | Gail Hill | 94451 | 170.0 |
| 1 | 43 | Gail Hill | 94451 | 170.0 |
| 2 | 36 | Rhoda Sweet | 92830 | 220.5 |
| 3 | 13 | Jescie Lyons | 92721 | 138.0 |
| 4 | 70 | Lyle Cash | 92750 | 257.0 |

---

### Displaying Graphs

Note:The ability to print and view graphs has been wrapped in a function. Use [output_plot()](/imat-search-basics#outputplot) to print graphs.

The information in this document is valid but intended for more advanced users. Using `output_plot()` along with the axis object (also called ax) is less complicated.

The primary function of Pandas is `.plot()`.

```python
dataframe.plot()
```

![](https://cdn.document360.io/5bf5f14a-9e3f-48aa-a2b9-2be6d9100091/Images/Documentation/dataframe-plot.png)

---

In this state, the graph is not very useful. By defining an x and y axis, it is possible to specify the information that appears on the table and on which axis.

```python
dataframe.plot(x='extract.age', y='extract.weight_standard')
```

![](https://cdn.document360.io/5bf5f14a-9e3f-48aa-a2b9-2be6d9100091/Images/Documentation/change-axis.png)

---

It is possible to choose which type of graph to display when using the `kind` parameter. Some common types of graphs are bar, line, scatter, barh and hist.

```python
dataframe.plot(x='extract.age', y='extract.weight_standard', kind='scatter')
```

![](https://cdn.document360.io/5bf5f14a-9e3f-48aa-a2b9-2be6d9100091/Images/Documentation/scatter.png)

---

```python
from pandas.tools.plotting import scatter_matrix
scatter_matrix(dataframe)
```

![](https://cdn.document360.io/5bf5f14a-9e3f-48aa-a2b9-2be6d9100091/Images/Documentation/scatter-matrix.png)
