Using a range of rows in data with ggplot

47 views
Skip to first unread message

Mahmood Naderan

unread,
Apr 21, 2021, 4:35:49 PM4/21/21
to ggp...@googlegroups.com
Hi,
My data file contains 100 rows and I want to specify a range of rows for some ggplot commands. Example is:

> mydata[1:6,]
                        GIPS          II        IPC        WG CTG       INST
bfs.1m.in_GPU      0.2505082    2.545049  12.923794 0.2986669   P   22868795
bfs.1m.multi_blk   1.7991085    9.456810   7.193173 0.1662331   P  498241029
bfs.ny.in_GPU      0.1428251    3.407084  16.787908 0.3879660   P    2356866
bfs.ny.multi_blk   1.4833925   14.484976   6.366725 0.1471340   P   21425712
cutcp.cutoff     263.4206978 6772.552997 219.138497 1.0000000   P 6445203210
histo.final        9.0960910    2.306704  11.723162 0.0868549   P   10267648
                 WRK
bfs.1m.in_GPU     P1
bfs.1m.multi_blk  P1
bfs.ny.in_GPU     P1
bfs.ny.multi_blk  P1
cutcp.cutoff      P2
histo.final       P3


However, when I use the following command

> ggplot(mydata[1:6,], aes(x = WRK)) + geom_violin(aes(y = GIPS, weight = WG), trim = FALSE)

I see the violin plot only for P1 (in the WRK column). I don't know why other rows (mydata[5:6,]) are not shown. The figure is available at https://pasteboard.co/JYpafxN.png
Any thoughts on that?



Regards,
Mahmood



Mahmood Naderan

unread,
Apr 21, 2021, 4:52:31 PM4/21/21
to Luke Tudge, ggp...@googlegroups.com
Right. I verified that :)
Thanks a lot.


Regards,
Mahmood





On Wed, Apr 21, 2021 at 10:46 PM Luke Tudge <luke...@gmail.com> wrote:
Maybe just because the other two categories P2 and P3 only contain one observation each? You can't have a violin plot for only one data point. That might be it.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/ggplot2/CADa2P2UvS4wY1EAL_DyT4_i7MDQhVdefXF-jf7nvP2Dg2sJdPQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages