pie-chart

Pie charts in ggplot2 with variable pie sizes

ぃ、小莉子 提交于 2019-11-27 14:30:23
I've tried various ways to get a facet_grid of pie charts in ggplot2 to vary width/radii according to another variable (strength). geom_bar accepts width=0.5 as a parameter but it is ignored once coord_polar is added. Adding width=0.5 to the ggplot aes or adding a aes to geom_bar doesn't work. I can't see any other relevant options for coord_polar . What's the easiest way to do this? The code below makes a nice grid of pie charts but doesn't change the sizes of the pie charts. What am I missing? mydata <- data.frame(side1=rep(LETTERS[1:3],3,each=9),side2=rep(LETTERS[1:3],9,each=3),widget=rep(c

d3.js spreading labels for pie charts

不羁岁月 提交于 2019-11-27 09:33:57
I'm using d3.js - I have a pie chart here. The problem though is when the slices are small - the labels overlap. What is the best way of spreading out the labels. http://jsfiddle.net/BxLHd/16/ Here is the code for the labels. I am curious - is it possible to mock a 3d pie chart with d3? //draw labels valueLabels = label_group.selectAll("text.value").data(filteredData) valueLabels.enter().append("svg:text") .attr("class", "value") .attr("transform", function(d) { return "translate(" + Math.cos(((d.startAngle+d.endAngle - Math.PI)/2)) * (that.r + that.textOffset) + "," + Math.sin((d.startAngle+d

How can i display pie chart in jsp page?

核能气质少年 提交于 2019-11-27 07:33:12
问题 <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page import="java.awt.*"%> <%@ page import="java.io.*"%> <%@ page import="org.jfree.chart.*"%> <%@ page import="org.jfree.chart.entity.*"%> <%@ page import="org.jfree.data.general.*"%> <% DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("JavaWorld", new Integer(75)); pieDataset.setValue("Other", new Integer

How to set different Label in Legend in Pie Chart

坚强是说给别人听的谎言 提交于 2019-11-27 07:28:47
问题 I'm currently doing a window form that have Pie Chart inside.I need to show the percentage of the pie. But now I have eencountered a problem : When I add this #PERCENT{P2} to series the Pie Chart will show like this: But if I remove it, the Pie Chart will show like this Is there possible to make the Pie Chart Like this? My Code: DataTable dt = new DataTable(); dt.Columns.Add("completed", typeof(string)); dt.Columns.Add("no", typeof(int)); int noin = allitem - intime; dt.Rows.Add("Complete In

how to add legend to a pie chart using D3js? And how to centralise the pie chart?

梦想与她 提交于 2019-11-27 06:16:42
问题 <script type="text/javascript"> var w = 400, //width h = 400, //height r = 150, //radius color = d3.scale.category20c(); //builtin range of colors data = [ {"label":"Single", "value":<?php echo $PercentageSingle; ?>}, {"label":"In a relationship", "value":<?php echo $PercentageInRe; ?>}, {"label":"Engaged", "value":<?php echo $PercentageEngaged; ?>}, {"label":"Married", "value":<?php echo $PercentageMarried; ?>}, {"label":"In an open relationship", "value":<?php echo $PercentageInOpenRe; ?>},

jfreechart customize piechart to show absolute values and percentages

断了今生、忘了曾经 提交于 2019-11-27 05:25:40
How can this compilable minimal code snippet example, which uses JFreeChart as plotting API, adapted in order to show both absoulte values AND percentages ? I couldn't extract this information neither from any code snippet on the internet nor from the JFreechart manual itself. The code snippet produces a pie chart showing only percentages. The absolute values in my case also matter, so i need to display them right under the percentages. Here is the code: (Note it lacks the imports) public class MyMinimalPieChartExample { public static void main(String[] args) { DefaultPieDataset dataset = new

R + ggplot2 => add labels on facet pie chart [duplicate]

余生颓废 提交于 2019-11-27 04:23:39
This question already has an answer here: ggplot, facet, piechart: placing text in the middle of pie chart slices 4 answers I want to add data labels on faceted pie char. Maybe someone can can help me. My data: year <- c(1,2,1,2,1,2) prod <- c(1,1,2,2,3,3) quantity <- c(33,50,33,25,34,25) df <- data.frame(year, prod, quantity) rm(year, prod, quantity) Code: library(ggplot2) # center's calculated by hand centr2 <- c(16, 25, 49, 62.5, 81, 87.5) ggplot(data=df, aes(x=factor(1), y=quantity, fill=factor(prod))) + geom_bar(stat="identity") + geom_text(aes(x= factor(1), y=centr2, label = df$quantity)

How to change amcharts pie themes?

帅比萌擦擦* 提交于 2019-11-27 04:08:02
问题 My HTML code is like this : <div id="chartdiv" style="width: 100%; height: 362px;"></div> My Javascript code is like this : var chart; var legend; var chartData = [ { "country": "Czech Republic", "litres": 301.9 }, { "country": "Ireland", "litres": 201.1 }, { "country": "Germany", "litres": 165.8 }, { "country": "Australia", "litres": 139.9 }, { "country": "Austria", "litres": 128.3 }, { "country": "UK", "litres": 99 }, { "country": "Belgium", "litres": 60 } ]; console.log(chartData);

How to add a legend to matplotlib pie chart?

拜拜、爱过 提交于 2019-11-27 03:27:45
问题 Using this example http://matplotlib.org/examples/pie_and_polar_charts/pie_demo_features.html how could I add a legend to this pie chart? My problem is that I have One big slice 88.4%, the second largest slice is 10.6%, and the other slices are 0.7 and 0.3%. The labels around the pie don't appear (except for the biggest slice) and neither the percentage values for the smaller slices. So I guess I can add a legend showing the names and the values. But I haven't found out how... # -*- coding:

ggplot2 pie and donut chart on same plot

独自空忆成欢 提交于 2019-11-27 00:06:32
I am trying to replicate this with R ggplot. I have exactly the same data: browsers<-structure(list(browser = structure(c(3L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 5L, 5L, 4L), .Label = c("Chrome", "Firefox", "MSIE", "Opera", "Safari"), class = "factor"), version = structure(c(5L, 6L, 7L, 8L, 2L, 3L, 4L, 1L, 10L, 11L, 9L), .Label = c("Chrome 10.0", "Firefox 3.5", "Firefox 3.6", "Firefox 4.0", "MSIE 6.0", "MSIE 7.0", "MSIE 8.0", "MSIE 9.0", "Opera 11.x", "Safari 4.0", "Safari 5.0" ), class = "factor"), share = c(10.85, 7.35, 33.06, 2.81, 1.58, 13.12, 5.43, 9.91, 1.42, 4.55, 1.65), ymax = c(10.85, 18.2,