bar-chart

D3.js Focus + Context Overflow

↘锁芯ラ 提交于 2019-12-12 21:19:40
问题 Hello all I'm trying to repurpose the Focus+Context graph found here: Focus + Context Example to work with a bar graph instead. I've been able to get the bars in but I have some overlap problems. When you make a selection in the context area the focus area will sometimes display bars that interfere with the display of the scale. Here's my code, there are some parts I know I need to clean up so lets not focus on that. Can someone point me in the right direction here? <!DOCTYPE html> <meta

Qt: 3D Horizontal Bar Chart

荒凉一梦 提交于 2019-12-12 21:13:33
问题 I am trying to draw a 3D horizontal bar chart using Qt 3D.I am trying to achieve this by drawing consecutive cuboids having the same x , y and rotation and translating them to different depths.But it seemed that changing the depth only is not working as both x and y are also changing and I can't figure it out. Update: I found out that the x and y attributes should also be changed by specific values. I hard-coded it and it works fine but I can't figure out an equation to do this automatic with

Plot text/labels centered on a dodged bar plot

风流意气都作罢 提交于 2019-12-12 19:32:14
问题 I can't figure out how to display labels centered on each dodged bar in a barplot in ggplot2 . I know that I can dodge the bars using position = "dodge" and I know that in order for the labels to show up centered on each bar I need to add position = position_dodge(width = 1) in the geom_text() or geom_label() command. But for some reason it doesn't work (see Figure below). I also added my data and code. df <- structure(list(Measure = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L,

How to plot multiple categorical variables in R

为君一笑 提交于 2019-12-12 19:25:33
问题 My data set contains several categorical variables that I would like visualise to see the distribution. For example, if I wanted to visualise the 4 variables (manufacturer, trans, fl, class) in the mpg data set in ggplot2, I have to write 4 lines of code: ggplot(mpg, aes(manufacturer)) + geom_bar() + coord_flip() ggplot(mpg, aes(trans)) + geom_bar() + coord_flip() ggplot(mpg, aes(fl)) + geom_bar() + coord_flip() ggplot(mpg, aes(class)) + geom_bar() + coord_flip() Resulting barplot: How can I

Bar plot with two y axes

。_饼干妹妹 提交于 2019-12-12 19:13:07
问题 I have the following code for a plot with 2 y-axes in MATLAB. I am glad that the 2-axes feature works, however, I would like to avoid the overlapping of the bars. Also, the categories on the right-hand axis should have different colors, not only yellow, yet it should be somehow clear that they are plotted on the right-hand axis and not the left one. How can this be done? EONMW = [100 399 500]; RWEMW = [200 996 120]; GermanByEON = [0.2 0.4 0.5]; GermanByRWE = [0.1 0.5 0.9]; EONGermanPortfolio

ggplot2 horizontal barplot with gradient color fill

主宰稳场 提交于 2019-12-12 17:47:58
问题 I am trying to create horizontal bar plot and would like to fill the individual bar as per their log fold values, white for lowest value and darkest for highest value. However, I am not able to do it. Here is my work, can somebody help me fix it? df <- data.frame(LogFold = c(14.20, 14.00, 8.13, 5.3, 3.8, 4.9, 1.3, 13.3, 14.7, 12.2), Tissue = c("liver", "adrenal", "kidney", "heart", "limb", "adipose", "brown", "hypothalamus", "arcuate", "lung")) df1<-df%>% arrange(desc(LogFold)) ggplot(data

Converting bar chart to pie chart in R

自作多情 提交于 2019-12-12 16:05:35
问题 I have following data and code: dd grp categ condition value 1 A X P 2 2 B X P 5 3 A Y P 9 4 B Y P 6 5 A X Q 4 6 B X Q 5 7 A Y Q 8 8 B Y Q 2 > > dput(dd) structure(list(grp = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L), .Label = c("A", "B"), class = "factor"), categ = structure(c(1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L), .Label = c("X", "Y"), class = "factor"), condition = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L), .Label = c("P", "Q"), class = "factor"), value = c(2, 5, 9, 6, 4, 5, 8, 2 )), .Names

How to color bar plots when using ..prop.. in ggplot?

感情迁移 提交于 2019-12-12 15:34:57
问题 I'm trying to color a bar plot on ggplot that shows the proportions. I call the plot using: v2 <- ggplot(data = Visual2_Data, mapping = aes(x = violation, y = ..prop.., group = 1, fill = violation)) + geom_bar() + facet_grid(~driver_race) + scale_fill_manual(values = c("red", "green", "yellow", "blue", "pink", "purple"))+ theme(axis.text.x = element_text(angle=90)) and my result is the following: Despite using the fill and scale_fill_manual , the bars are still the default color. As soon as I

Creating a horizontal bar plots in the reverse direction

怎甘沉沦 提交于 2019-12-12 15:31:39
问题 I'm trying to do a pyramid-"like" plot in R and I think I am close. I know there are functions such as plotrix's pyramid.plot but what I want to do isn't a real pyramid plot. In a pyramid plot, there are text labels down the middle that line up with the bars on the left and on the right. Instead, what I'd like to do is have two columns of text with bars coming away from them. I'm using ggplot (but I guess I don't have to) and the multiplot function. A minimal example would be something like

AChartEngine does not display the maximum chart value - Bar Chart

江枫思渺然 提交于 2019-12-12 14:16:20
问题 I am working on Achart Engine and i am facing 2 issues Issue 1) i am facing exactly same problem as posted in the screen shot here displaying max chart values on Y axis 2) suppose in the 3 bars if i one among the bar is 0 say middle one then the bar will not be drawn and shows blank between the two bars, but i dont want to show some space. On Issues what i want to acheive: Issue 1) My Ymax value is 50 ,i can make the Y max value to 60 so that the max value is displayed and will not cut.But