question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pie chart doesn't have Axes?

See original GitHub issue

Bug Report

Issue: (Bug description goes here) Pie chart and legend overlaps XAxis2.

In multiplot it’s not consistent with other plots: image

Depending on plot size it’s pie is covering the title: image

Reproducing: (What do others have to do to reproduce the bug?)

RoslynPad:

#r "nuget:ScottPlot/4.1.33"
using System.Drawing;
using ScottPlot;

var plt = new ScottPlot.Plot(300, 300);
plt.Title("Winners Losers Total");
double[] values = { 100, 50 };
string[] labels = { "Winners", "Losers" };
var pie = plt.AddPie(values);
pie.SliceLabels = labels;
pie.SliceFillColors = new Color[] { Color.ForestGreen, Color.Crimson };
var legend = plt.Legend();
legend.Location = Alignment.UpperRight;
plt.SaveFig("pie.png");

System Details

  • ScottPlot Version: 4.1.32
  • Operating System: Windows10
  • Application Type: console
  • .NET Version: NET 6.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
swhardencommented, Feb 6, 2022

In your WinForms example did you resize the window or is that default rendering?

I was using the default rendering

the legend overlaps the pie

You may do well to move the legend outside the plot. You can call formsPlot1.Plot.GetLegendBitmap() to get the legend image then perhaps display it in your window on a Picturebox or render it on your larger Bitmap or something.

Hope it helps! Scott

1reaction
swhardencommented, Feb 6, 2022

To hide everything but the title label you can use the code above then manually hide the grid lines, axis border lines, and ticks. This will retain space for the title and prevent the circle from overlapping it.

plt.Grid(false);

plt.YAxis.Line(false);
plt.YAxis2.Line(false);
plt.XAxis.Line(false);
plt.XAxis2.Line(false);

plt.YAxis.Ticks(false);
plt.YAxis2.Ticks(false);
plt.XAxis.Ticks(false);
plt.XAxis2.Ticks(false);

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change the display of chart axes
Important: This article does NOT cover changing the scale of chart axes. ... Radar charts do not have horizontal (category) axes, and pie...
Read more >
Add or remove titles in a chart
Some chart types (such as radar charts) have axes, but they cannot display axis titles. You can't add axis titles to charts that...
Read more >
Pie charts and using the Y and X axis - English
Pie Charts have only Y-Values which build the segments of the pie. There are NO X-values and no x-axis. AlexKemp ...
Read more >
Where data appears on pie charts
Pie charts do not have a typical X-axis and Y-axis. Compare the report in Figure 1 and the pie chart in Figure 2...
Read more >
How to Choose Between a Bar Chart and Pie Chart
Bar charts and pie charts are very common chart types with some overlap in use cases. In this article, you'll learn more about...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found