<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: GGPLOT: How to Display the Last Value of Each Line as Label	</title>
	<atom:link href="https://www.datanovia.com/en/blog/ggplot-how-to-display-the-last-value-of-each-line-as-label/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.datanovia.com/en/blog/ggplot-how-to-display-the-last-value-of-each-line-as-label/</link>
	<description>Data Mining and Statistics for Decision Support</description>
	<lastBuildDate>Wed, 21 Oct 2020 18:16:34 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>
		By: kassambara		</title>
		<link>https://www.datanovia.com/en/blog/ggplot-how-to-display-the-last-value-of-each-line-as-label/#comment-21174</link>

		<dc:creator><![CDATA[kassambara]]></dc:creator>
		<pubDate>Wed, 21 Oct 2020 18:16:34 +0000</pubDate>
		<guid isPermaLink="false">https://www.datanovia.com/en/?p=16541#comment-21174</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.datanovia.com/en/blog/ggplot-how-to-display-the-last-value-of-each-line-as-label/#comment-21171&quot;&gt;sfer&lt;/a&gt;.

It is possible to add min-max values as follow:




&lt;pre class=&quot;r&quot;&gt;&lt;code&gt;library(tidyverse)

# Demo data
df2 &#060;- Orange

# Compute summary statistics
# Create labels to be added at the end of the lines
data_ends &#060;- df2 %&#062;%
  group_by(Tree) %&#062;%
  summarise(
    min_val = min(circumference),
    max_val = max(circumference)
  ) %&#062;%
  mutate(label = paste0(&#034;[&#034;, min_val, &#034; - &#034;, max_val, &#034;]&#034;))
#&#062; `summarise()` ungrouping output (override with `.groups` argument)


# Add min-max values
ggplot(df2, aes(x = age, y = circumference)) +
  geom_line(aes(color = Tree)) +
  scale_y_continuous(sec.axis = sec_axis(~., breaks = data_ends$max_val, labels = data_ends$label))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/zuK7UbJ.png&quot; /&gt;&lt;/p&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.datanovia.com/en/blog/ggplot-how-to-display-the-last-value-of-each-line-as-label/#comment-21171">sfer</a>.</p>
<p>It is possible to add min-max values as follow:</p>
<pre class="r"><code>library(tidyverse)

# Demo data
df2 &lt;- Orange

# Compute summary statistics
# Create labels to be added at the end of the lines
data_ends &lt;- df2 %&gt;%
  group_by(Tree) %&gt;%
  summarise(
    min_val = min(circumference),
    max_val = max(circumference)
  ) %&gt;%
  mutate(label = paste0(&quot;[&quot;, min_val, &quot; - &quot;, max_val, &quot;]&quot;))
#&gt; `summarise()` ungrouping output (override with `.groups` argument)


# Add min-max values
ggplot(df2, aes(x = age, y = circumference)) +
  geom_line(aes(color = Tree)) +
  scale_y_continuous(sec.axis = sec_axis(~., breaks = data_ends$max_val, labels = data_ends$label))</code></pre>
<p><img src="https://i.imgur.com/zuK7UbJ.png" /></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: sfer		</title>
		<link>https://www.datanovia.com/en/blog/ggplot-how-to-display-the-last-value-of-each-line-as-label/#comment-21171</link>

		<dc:creator><![CDATA[sfer]]></dc:creator>
		<pubDate>Wed, 21 Oct 2020 16:55:03 +0000</pubDate>
		<guid isPermaLink="false">https://www.datanovia.com/en/?p=16541#comment-21171</guid>

					<description><![CDATA[Good post, Kassambara - (as always!).

Question:
how to add BOTH the min and also the MAX values
at the end of each line?.

Thanks/Merci!]]></description>
			<content:encoded><![CDATA[<p>Good post, Kassambara &#8211; (as always!).</p>
<p>Question:<br />
how to add BOTH the min and also the MAX values<br />
at the end of each line?.</p>
<p>Thanks/Merci!</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Object Caching 115/162 objects using Memcached
Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Database Caching 38/55 queries in 0.015 seconds using APC

Served from: www.datanovia.com @ 2025-07-23 21:28:15 by W3 Total Cache
-->