bar-chart

Bokeh Plot with a nominal or ordinal axis type

痴心易碎 提交于 2020-01-02 11:06:11
问题 Edit: The code in the original question refers to a version of Bokeh that is years out of date. But the answer below has been updated to answer the same question for modern versions of Bokeh Bokeh Plot with a nominal axis type from bokeh.plotting import * from bokeh.objects import * output_notebook() label = ['United States', 'Russia', 'South Africa', 'Europe (average)', 'Canada', 'Austalia', 'Japan'] number = [1, 2, 3, 4, 5, 6, 7] value = [700, 530, 400, 150, 125, 125, 75] yr = Range1d(start

R-stacked-grouped barplot with different fill in R

五迷三道 提交于 2020-01-02 08:04:13
问题 I have the following code: library(ggplot2) K <- data.frame(KK=c("30", "30", "30", "30","10", "10", "10", "10"),k=c("10", "8", "5", "2","10", "8", "5", "2"), Precision=c(85.2,87.5,100,100,82.5,83.3,85.2,94.4), Recall=c(73.3,80,100,100,51.4,54.8,61.1,87.9) , Fscore=c(70.8,79.4,100,100,49.1,54.2,62.7,90.3), Accuracy=c(82.2,86.7,100,100,63.3,66.7,73.3,93.3)) df2 <- reshape2::melt(K, 1:2) ggplot(df2, aes(k, value, fill = variable)) + geom_bar(stat = 'identity', position = 'dodge') + theme(legend

R-stacked-grouped barplot with different fill in R

早过忘川 提交于 2020-01-02 08:04:04
问题 I have the following code: library(ggplot2) K <- data.frame(KK=c("30", "30", "30", "30","10", "10", "10", "10"),k=c("10", "8", "5", "2","10", "8", "5", "2"), Precision=c(85.2,87.5,100,100,82.5,83.3,85.2,94.4), Recall=c(73.3,80,100,100,51.4,54.8,61.1,87.9) , Fscore=c(70.8,79.4,100,100,49.1,54.2,62.7,90.3), Accuracy=c(82.2,86.7,100,100,63.3,66.7,73.3,93.3)) df2 <- reshape2::melt(K, 1:2) ggplot(df2, aes(k, value, fill = variable)) + geom_bar(stat = 'identity', position = 'dodge') + theme(legend

Mp Android Chart Scrolling the data from right to left

非 Y 不嫁゛ 提交于 2020-01-02 05:33:07
问题 I'm Building a barchart using MpAndroid chart library, i've around 50 - 60 bars and wanted to display the 60th initially i.e. display the last element in the ArrayList and the scroll should be from right to Left. Main motive is to display the end of the chart during the initial load of the chart barchart. Thanks in Advance. 回答1: This worked for me. chart.setData(...); // first set data // now modify viewport chart.setVisibleXRangeMaximum(20); // allow 20 values to be displayed at once on the

Bidirectional bar chart with positive labels on both sides ggplot2

こ雲淡風輕ζ 提交于 2020-01-02 05:11:10
问题 I'm try to create a bidirectional bar chart in ggplot where axis labels and data labels both above and below the axis are positive. So for example, if your data was: myData <- data.frame(category = c("yes", "yes", "no", "no"), month = c('Jan', 'Feb', 'Jan', 'Feb'), values = c(6, 5, 4, 3)) I'd want two columns, one for January and one for February, where the 'yes' values appeared pin bars pointing up with positive axis and data labels, and the 'no' values pointing down, also with positive axis

matplotlib xticks labels overlap

℡╲_俬逩灬. 提交于 2020-01-02 01:41:06
问题 I am not able to get nicer spaces between the xticks with the following code: import random import matplotlib.pyplot as plt coverages = [random.randint(1,10)*2] * 100 contig_names = ['AAB0008r'] * len(coverages) fig = plt.figure() fig.clf() ax = fig.add_subplot(111) ax.yaxis.grid(True, linestyle='-', which='major', color='grey', alpha=0.5) ind = range(len(coverages)) rects = ax.bar(ind, coverages, width=0.2, align='center', color='thistle') ax.set_xticks(ind) ax.set_xticklabels(contig_names)

Plotly: Grouped Bar Chart with multiple axes

巧了我就是萌 提交于 2020-01-02 01:07:56
问题 When I set barmode='group' in Layout while trace2 = Bar(...,yaxis='y2') , this leads bars to be stacked or overlayed instead of grouping them. How can I group the bars while having multiple axes? I went over these but no avail: With single Y axis grouped bar chart is shown here. Multiple axes is also explained here and reference for y-axis is available here 回答1: Here's an example of a grouped bar charts with multiple axes: https://plot.ly/~etpinard/2080/grouped-bars-on-multiple-axes/ The

ggplot reorder stacked bar plot based on values in data frame

好久不见. 提交于 2020-01-01 14:41:37
问题 I am making stacked bar plots with ggplot2 in R with specific bar ordering about the y-axis. # create reproducible data library(ggplot2) d <- read.csv(text='Day,Location,Length,Amount 1,4,3,1.1 1,3,1,2 1,2,3,4 1,1,3,5 2,0,0,0 3,3,3,1.8 3,2,1,3.54 3,1,3,1.1',header=T) ggplot(d, aes(x = Day, y = Length)) + geom_bar(aes(fill = Amount, order = Location), stat = "identity") ggplot(d, aes(x = Day, y = Length)) + geom_bar(aes(fill = Amount, order = rev(Location)), stat = "identity") The first ggplot

Floating Bar Chart

核能气质少年 提交于 2020-01-01 09:27:10
问题 I'm trying to make a plot where the x-axis is time and the y-axis is a bar chart that will have the bars covering a certain time period like this: ______________ |_____________| _____________________ |___________________| -----------------------------------------------------> time I have 2 lists of datetime values for the start and end of these times I'd like to have covered. So far I have x = np.array([dt.datetime(2010, 1, 8, i,0) for i in range(24)]) to cover a 24-hour period. My question

How to Display AChartEngine bar chart properly

◇◆丶佛笑我妖孽 提交于 2020-01-01 09:22:48
问题 I am using achartengine 1.0.1 (latest) and want to demonstrate a bar chart. This is what I want: My Desired Graph What I achieved so far 1:1 view: Zoom-out View: Problems: the left and right portion of graph are lost in 1:1 view. The distance between Bar is so much high. I need to reduce it. The Bar is not appropriately above the text label. The text label color is white. I tried setLabelColor() but not working. The text-size above bar is small. XAxis Text "AC", "WA" etc are overlapping with