# ggplot2 package

The <mark style="color:purple;">**ggplot2**</mark> package is a simplified implementation of grammar of graphics written by Hadley Wickham for R.

## Components of Grammar of Graphics

<figure><img src="/files/IgcIi74xtvB7Yt6F7jFJ" alt=""><figcaption><p>Grammar of Graphics Components (<a href="https://youtu.be/ckdHNu4kfL0?t=4235">source</a>)</p></figcaption></figure>

### Aesthetics in ggplot2

<figure><img src="/files/I2HGaQhEALPrpACp4j7y" alt=""><figcaption><p>Aesthetics in ggplot2 package (<a href="https://youtu.be/ckdHNu4kfL0?t=4317">source</a>)</p></figcaption></figure>

### <mark style="color:red;">`vjust()`</mark> and <mark style="color:red;">`hjust()`</mark>

To adjust the horizontal and vertical justification of labels and texts of a graph we can use the following image as a reference.

<figure><img src="/files/lC7Yix0AaesMx4Vyw87Q" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ar-riyaz.gitbook.io/r-for-bioinformatics/data-visualization-in-r/ggplot2-package.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
