Can someone explain me what does this subdivision means (ggplot2) bar_plot

39 views
Skip to first unread message

Cesar Ruiz

unread,
Aug 23, 2016, 7:03:46 AM8/23/16
to ggplot2
Hi everyone,

when running these lines

A5<-plot_bar(Spo_Caribe, fill = "Class")
A5 + geom_bar(aes(color = Class, fill = Class), stat = "identity", position = "stack")


i got this graph



I would like to know what does means de subdivisions inside the table, I mean this kind of subgroups marked by white lines between my samples.



thanks for your help



César
Auto Generated Inline Image 1

Zack Weinberg

unread,
Aug 23, 2016, 7:43:25 AM8/23/16
to Cesar Ruiz, ggplot2
On Tue, Aug 23, 2016 at 6:36 AM, Cesar Ruiz <cr...@natalesoft.com> wrote:
>
> I would like to know what does means de subdivisions inside the table, I mean this
> kind of subgroups marked by white lines between my samples.

I don't think it means anything; I think it's a rendering artifact.
Do the positions of the white lines change if you change the width of
the plot?

zw

Cesar Ruiz

unread,
Aug 23, 2016, 8:08:26 AM8/23/16
to ggplot2, cr...@natalesoft.com

Zack, yes in fact subdivision changes with the width....
Maybe it means nothing....

but if someone has another idea, is welcome
Thanks, 
César

 
zw

Roman Luštrik

unread,
Aug 23, 2016, 8:33:30 AM8/23/16
to Cesar Ruiz, ggplot2

--
--
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.

Zack Weinberg

unread,
Aug 23, 2016, 8:38:14 AM8/23/16
to Cesar Ruiz, ggplot2

On Aug 23, 2016 8:08 AM, "Cesar Ruiz" <cr...@natalesoft.com> wrote:
>
>
>
> El martes, 23 de agosto de 2016, 13:43:25 (UTC+2), Zack Weinberg escribió:
>>
>> On Tue, Aug 23, 2016 at 6:36 AM, Cesar Ruiz <cr...@natalesoft.com> wrote:
>> >
>> > I would like to know what does means de subdivisions inside the table, I mean this
>> > kind of subgroups marked by white lines between my samples.
>>
>> I don't think it means anything; I think it's a rendering artifact.
>> Do the positions of the white lines change if you change the width of
>> the plot?
>>
>
> Zack, yes in fact subdivision changes with the width....
> Maybe it means nothing....

I believe what's going on is, ggplot is trying to leave a thin gap between *each bar* and its neighbors, but because your plot is so dense, the screen is only showing some of them. Which ones are visible is pure accident, a beat frequency of the bar width and the screen resolution.

Experiment with the size= parameter to geom_bar; if I remember correctly, this controls the width of the bars. If you don't want gaps at all, geom_raster may be more cooperative, but you might have to reorganize the data for that to work.

zw

Reply all
Reply to author
Forward
0 new messages