Is qplot different from plot?

33 views
Skip to first unread message

石浜裕太郎

unread,
Aug 6, 2017, 3:49:09 AM8/6/17
to ggplot2
I would like to plot the fitting result using RStan.
This successfully generated the result, which is saved in fit.
When I use 

plot(fit, pars=par)

it worked.

But, when I use
qqplot(fit)+geom_line()

it did not work.

I did not forget library(ggplot2).

I am wondering if 

rstan::extract(fit)

is needed.

Thanks in advance for your kind help

Roman Luštrik

unread,
Aug 6, 2017, 5:38:16 AM8/6/17
to 石浜裕太郎, ggplot2
Perhaps you could describe what yo're trying to plot. Mean with confidence interval for every parameter? Can you give a reproducible example?

Cheers,
Roman

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
In God we trust, all others bring data.

Theo Mouton

unread,
Aug 6, 2017, 7:36:14 AM8/6/17
to 石浜裕太郎, ggplot2

Ggplot has a personal grammar which you will have to learn if you want to use ggplots.

First a ggplot starts by:
ggplot(data=, aes(x=,y=)).

Please see the Rstudio ggplot2 cheatsheet or the many stackoverflow questions





Theo Mouton
Freshwater Research Assistant
+64-7-859-1889 | Gate 10 Silverdale Road, Hillcrest, Hamilton | www.niwa.co.nz
NIWA
To ensure compliance with legal requirements and to maintain cyber security standards, NIWA's IT systems are subject to ongoing monitoring, activity logging and auditing. This monitoring and auditing service may be provided by third parties. Such third parties can access information transmitted to, processed by and stored on NIWA's IT systems.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com

More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.

Hiroaki Yutani

unread,
Aug 6, 2017, 10:48:43 AM8/6/17
to 石浜裕太郎, ggplot2
plot() is a generic function and knows how to plot because the specific method for stanfit class is implemented in rstan package and the method generates ggplot object ("gg" class) so you can add other layers like geom_line() by + operator.

qplot() is not such kind of a function; it is just a shortcut for ggplot(). If you need more control over the plot than what plot() automatically does, I guess you will need to execute rstan::extract() and manually compose a ggplot by yourself.

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com

More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.

石浜裕太郎

unread,
Aug 7, 2017, 4:21:53 PM8/7/17
to ggplot2
thanks very much. I am studying this issue by starting from what rstan::extract() generates.

2017年8月6日日曜日 23時48分43秒 UTC+9 Hiroaki Yutani:
plot() is a generic function and knows how to plot because the specific method for stanfit class is implemented in rstan package and the method generates ggplot object ("gg" class) so you can add other layers like geom_line() by + operator.

qplot() is not such kind of a function; it is just a shortcut for ggplot(). If you need more control over the plot than what plot() automatically does, I guess you will need to execute rstan::extract() and manually compose a ggplot by yourself.
2017-08-06 16:49 GMT+09:00 石浜裕太郎 <ishiham...@hotmail.com>:
I would like to plot the fitting result using RStan.
This successfully generated the result, which is saved in fit.
When I use 

plot(fit, pars=par)

it worked.

But, when I use
qqplot(fit)+geom_line()

it did not work.

I did not forget library(ggplot2).

I am wondering if 

rstan::extract(fit)

is needed.

Thanks in advance for your kind help

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com

More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.

石浜裕太郎

unread,
Aug 7, 2017, 4:22:29 PM8/7/17
to ggplot2, ishiham...@hotmail.com, Theo....@niwa.co.nz
thanks very much. I will refer to this cheatsheet.

2017年8月6日日曜日 20時36分14秒 UTC+9 Theo Mouton:

石浜裕太郎

unread,
Aug 7, 2017, 4:24:36 PM8/7/17
to ggplot2
thanks very much for the reply.I would like to plot mean with confidence.

2017年8月6日日曜日 18時38分16秒 UTC+9 Roman Luštrik:
Perhaps you could describe what yo're trying to plot. Mean with confidence interval for every parameter? Can you give a reproducible example?

Cheers,
Roman
On Sun, Aug 6, 2017 at 9:49 AM, 石浜裕太郎 <ishiham...@hotmail.com> wrote:
I would like to plot the fitting result using RStan.
This successfully generated the result, which is saved in fit.
When I use 

plot(fit, pars=par)

it worked.

But, when I use
qqplot(fit)+geom_line()

it did not work.

I did not forget library(ggplot2).

I am wondering if 

rstan::extract(fit)

is needed.

Thanks in advance for your kind help

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com

More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages