overlapping lables in JFreeChart pie charts - graph

i'm using JFreeChart to plot some data in to a pie chart. when the amount of data is getting high
the labels of the graph is overlapping as shown below?
can any one suggest me to avoid this issue and show the labels clearly??
--
Regards Rangana

You could use a smaller font:
PiePlot plot = (PiePlot) chart.getPlot();
int fontSize = 10; // Adjust the size here
plot.setLabelFont(new Font("SansSerif", Font.PLAIN, fontSize));

i was able to reduce this problem by showing the pie chart as a 2d pie chart rather than a 3d one. it gave me a final result like the one similar to the https://stackoverflow.com/a/13309587/230513 suggested by #trashgod
i think i will be able add more color to the solution by implementing the suggestion done by #obourgain
Thanks guys!

Related

How to move the legend to outside the plotting area in Plots.jl (GR)?

I have the following plot where part of the data is being obscured by the legend:
using Plots; gr()
using StatPlots
groupedbar(rand(1:100,(10,10)),bar_position=:stack, label="item".*map(string,collect(1:10)))
I can see that using the "legend" attribute, the legend can be moved to various locations within the plotting area, for example:
groupedbar(rand(1:100,(10,10)),bar_position=:stack, label="item".*map(string,collect(1:10)),legend=:bottomright)
Is there any way of moving the plot legend completely outside the plotting area, for example to the right of the plot or below it? For these kinds of stacked bar plots there's really no good place for the legend inside the plot area. The only solution I've been able to come up with so far is to make some "fake" empty rows in the input data matrix to make space with some zeros, but that seems kind of hacky and will require some fiddling to get the right number of extra rows each time the plot is made:
groupedbar(vcat(rand(1:100,(10,10)),zeros(3,10)),bar_position=:stack, label="item".*map(string,collect(1:10)),legend=:bottomright)
I can see that at there was some kind of a solution proposed for pyplot, does anyone know of a similar solution for the GR backend? Another solution I could imagine - is there a way to save the legend itself to a different file so I can then put them back together in Inkscape?
This is now easily enabled with Plots.jl:
Example:
plot(rand(10), legend = :outertopleft)
Using layouts I can create a workaround making a fake plot with legend only.
using Plots
gr()
l = #layout [a{0.001h}; b c{0.13w}]
values = rand(1:100,(10,10))
p1 = groupedbar(values,bar_position=:stack, legend=:none)
p2 = groupedbar(values,bar_position=:stack, label="item".*map(string,collect(1:10)), grid=false, xlims=(20,3), showaxis=false)
p0=plot(title="Title",grid=false, showaxis=false)
plot(p0,p1,p2,layout=l)

Ternary Plot detail/clipping in R

I have used triax.plot to create a ternary plot.
require(plotrix)
data <- read.csv("~/R/datasets/data.csv")
triax.plot(data[1:18721,],main="ternary plot", tick.labels=list(b=seq(10,90,by=10),l=seq(10,90,by=10),r=seq(10,90,by=10)), pch=4)
However most of the data forms a cluster that I want to display in more detail. I would like to edit the axis range (not the labels, not the ticks) to display only the relevant area of the original plot
highlighted in this image. The resulting clipping would also be a isosceles triangle.
Apparently triax.plot has no option for this. Or am I missing something? Any suggestions for alternative approaches are appreciated. Thanks in advance!

Spacing Between Multiple X-Axes in JFreeChart

I'm attempting to try and increase the vertical spacing between multiple x-axes using JFreeChart. Currently, my charts look like this:
Current chart
However, I need to produce something like the following so that the x-axes are more clearly defined (note that the vertical spacing between the x-axes is larger than in the first image):
Desired chart
Does any one have any idea on how to do this? I've been searching the JFreeChart API for > 2 days now and can't find anything that directly addresses the issue other than attempting to use org.jfree.chart.axis.AxisSpace in some way.
Many thanks for any help!
One approach would be to customise the axis label insets (that is, increase the space below each axis label).
http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/axis/Axis.html#setLabelInsets-org.jfree.ui.RectangleInsets-

How to create a stacked JavaFX Chart, with multiple Y Axis and common X Axis

Actually, I have exactly the same problem which was previously asked in the following link for D3. But I am searching a solution in JavaFx.
How to create Stacked Line Chart D3, Multiple Y Axis and common X Axis
VinceOPS thank you for answering but making the axis invisible cannot solve the problem since it will be used as common axis of a chart-set and at least one of the charts should display it.
This morning I've found an elegant solution for the common-axis-multichart problem.
If you use a common axis with multi-charts; at least one of the charts should display it where the others shouldn't.
The trick that I found is the following
// Inherit from XYChart and in c'tor remove the axis from chart-children.
public DoNotDisplayXAxisChartConstructor(Axis<Number> xAxis, Axis<Number> yAxis)
{
super(xAxis, yAxis);
getChartChildren().remove(xAxis);
// And now the chart can use the xAxis for layout but cannot display it.
}
It works...
I would personally use a VBox to vertically stack two Charts, and then hide the X-axis of the first one :
// if chart.getXAxis().setVisible(false) doesn't do the trick:
chart.getXAxis().setTickLabelsVisible(false);
chart.getXAxis().setOpacity(0);

How can we create a Radial Pie chart?

How can we create a Radial-Pie-Chart in Flex?
Basically i am trying to create a stacked pie chart.
What should i do to achieve this?
Can we show stacked column chart in a pie?
Thanks
One data visualization API that can be used in Flex is Axiis:
http://www.axiis.org/examples.html
Take a look at this sample to see if this is close to what you are looking for:
http://www.axiis.org/examples/WedgeStackChartExample.html

Resources