Bug 506925 - Error Plotting Polar Graphs
Summary: Error Plotting Polar Graphs
Status: REOPENED
Alias: None
Product: LabPlot2
Classification: Applications
Component: general (other bugs)
Version First Reported In: 2.12.0
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: Alexander Semke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-11 19:50 UTC by Roger Júnio
Modified: 2025-08-18 16:42 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot showing the graph with incomplete plotting. (155.71 KB, image/png)
2025-07-11 19:50 UTC, Roger Júnio
Details
LabPlot with r=3 (142.64 KB, image/png)
2025-07-19 18:06 UTC, Roger Júnio
Details
KmPlot with r = cos(4*phi) (357.77 KB, image/png)
2025-07-19 18:09 UTC, Roger Júnio
Details
Labplot with maximum range parameter set to "2 * 3.14" instead of "2 * pi" (201.71 KB, image/png)
2025-07-19 21:46 UTC, Roger Júnio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roger Júnio 2025-07-11 19:50:43 UTC
Created attachment 183171 [details]
Screenshot showing the graph with incomplete plotting.

SUMMARY
I was following a basic tutorial on how to use LabPlot2, and I noticed an apparent error when trying to plot graphs for polar equations. The YouTube tutorial link is below, and the actual error occurs between 2:20 and 2:45 of the video:

https://youtu.be/dMmQmExjbU8?si=J02ejhHnPRe9xYUU&t=163

I tried creating an equation with different values, opening a new graph area, and the problem seems to be with the polar plotting function.

STEPS TO REPRODUCE
1. Open LabPlot2
2. In the open default project, add a new worksheet
3. In the new worksheet, add two axes (any)
4. In the new graph area, add a formula plot
5. Change the equation type to polar
6. Enter any equation or constant in the formula editor and press "Recalculate"
7. Here's the error. Instead of a complete polar graph, the plot displays only a small fragment of a line.

OBSERVED RESULT
The plot displays only a small fragment of a line.

EXPECTED RESULT
The graph shows the complete line.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.4.2
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1
Kernel Version: 6.15.6-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5700U with Radeon Graphics
Memory: 16 GiB of RAM (15.0 GiB usable)
Graphics Processor: AMD Radeon Graphics

ADDITIONAL INFORMATION
LabPlot2 was installed from the official Arch repository.
Comment 1 Martin 2025-07-19 05:56:58 UTC
Hello Roger Júnio,

the behaviour you are seeing is correct. Basically you specify the radius with the equation you are entering.

radius = <your equation>
rotating by phi
So when you wanna have a circle with radius 3 just type 3 into the equation field

In your example you change the radius with cos(phi):
x = cos(phi) * cos(phi)
y = sin(phi) * cos(phi)

Here you can find another example of a spiral:
https://invent.kde.org/education/labplot/-/merge_requests/750/diffs#17283e1cc265ec2589eda89fdb055b005fcf05e7
Comment 2 Roger Júnio 2025-07-19 18:06:49 UTC
Created attachment 183346 [details]
LabPlot with r=3

LabPlot r=3, with the ϕ range explicitly set from 0 to 2*pi.
Comment 3 Roger Júnio 2025-07-19 18:09:03 UTC
Created attachment 183347 [details]
KmPlot with r = cos(4*phi)

KmPlot correctly generates the complete 8-petal rose curve
Comment 4 Roger Júnio 2025-07-19 18:13:30 UTC
Hi Martin, I hope this message finds you well.

Following up on my previous report and the valuable discussion around Bug 506925, I wanted to share some further observations and evidence that might shed more light on the polar graph plotting behavior. I've conducted a couple more tests that suggest there might be an unexpected rendering aspect in LabPlot, even when the mathematical equations are straightforward.

I've attached two new screenshots that I hope will be helpful for your investigation:

    LabPlot with r=3: Plotting a Constant Radius
    When attempting to plot a very simple constant polar equation, r = 3, with the ϕ range explicitly set from 0 to 2*pi, LabPlot currently displays only an arc instead of the expected full circle. This behavior seems to be consistently observed.

    KmPlot with r = cos(4*phi): Comparison
    To provide a point of comparison and confirm the mathematical correctness and desired visualization, I also plotted r = cos(4*phi) in KmPlot, using its standard configurations. As you can see in the attached image, KmPlot successfully generates the complete 8-petal rose curve. This comparison suggests that there might be a subtle difference in how LabPlot handles or renders polar coordinates, as the same input yields a complete graph in another application.

I also wanted to mention that I initially encountered this behavior while following one of LabPlot2's own tutorials.

I truly appreciate the dedication and hard work that goes into developing LabPlot; it's a fantastic tool for scientific plotting. I'd be very grateful if you could take another look at this report in light of these new observations and the attached screenshots. Perhaps there's a specific configuration or an overlooked detail that could explain this behavior, or maybe a small refinement that could make polar plotting even more robust.

Thank you again for all your efforts!
Comment 5 Martin 2025-07-19 19:57:32 UTC
Sorry for my misunderstanding. The problem was that 2*pi was not parsed properly. Will be fixed with https://invent.kde.org/education/labplot/-/merge_requests/751
Comment 6 Roger Júnio 2025-07-19 21:46:02 UTC
Created attachment 183358 [details]
Labplot with maximum range parameter set to "2 * 3.14" instead of "2 * pi"

With a direct decimal specification, the function plots without error.
Comment 7 Roger Júnio 2025-07-19 21:55:47 UTC
That's fine; in fact, by replacing the maximum range parameter with "2 * 3.14" instead of "2 * pi", the function is now fully visualized. Thankfully, the issue has been successfully identified; we'll be waiting for the updates to reach the Arch repositories.

Otherwise, just two quick suggestions regarding my brief experience with LabPlot: 1. It would be helpful to have a keyboard shortcut for "Recalculate," or to do so by pressing Enter in the equation field; 2. The option to switch between fields neatly with the Tab and Shift+Tab key instead of clicking would be very practical.

Thank you in advance for your attention to my report.
Comment 8 Alexander Semke 2025-07-22 09:09:37 UTC
(In reply to Roger Júnio from comment #7)
> That's fine; in fact, by replacing the maximum range parameter with "2 *
> 3.14" instead of "2 * pi", the function is now fully visualized. Thankfully,
> the issue has been successfully identified; we'll be waiting for the updates
> to reach the Arch repositories.
The fix will be part of the upcoming patch release 2.12.1. Thank you for reporting this issue.

> 
> Otherwise, just two quick suggestions regarding my brief experience with
> LabPlot: 1. It would be helpful to have a keyboard shortcut for
> "Recalculate," or to do so by pressing Enter in the equation field; 2. The
> option to switch between fields neatly with the Tab and Shift+Tab key
> instead of clicking would be very practical.
The tab order is indeed broken for many widgets in the project explorer. We addressed now some of the most obvious problems in this area and will bring this fix into the coming patch. The remaining issues with switching the different tabs in the project explorer when navigating via Tab and Shift+Tab will be addressed in the next major release 3.0.

The idea with Shift+Enter to recalculate the results is very nice and this shortcut we have already in our notebook interface to trigger the evaluation/recalculation of the cells. We implemented this shortcut now also in the properties explorer to re-trigger the re-calculation of formula and analysis curves. We'll also add this small improvement into the upcoming patch release. Thank you for this idea!

If you want to give it a try earlier, you can try out our nightly builds. Additionally to the fixes that are also part of the next patch release, the new features and developments are documented on https://discuss.kde.org/t/labplot-post-v2-12-new-features-and-development-news/35074. If you have any other ideas or feedback, you can also reach out to us on Matrix.
Comment 9 Roger Júnio 2025-08-17 20:12:36 UTC
(In reply to Alexander Semke from comment #8)
> The fix will be part of the upcoming patch release 2.12.1. Thank you for
> reporting this issue.

Very good - and it was a pleasure!

> The tab order is indeed broken for many widgets in the project explorer. We
> addressed now some of the most obvious problems in this area and will bring
> this fix into the coming patch. The remaining issues with switching the
> different tabs in the project explorer when navigating via Tab and Shift+Tab
> will be addressed in the next major release 3.0.
> 
> The idea with Shift+Enter to recalculate the results is very nice and this
> shortcut we have already in our notebook interface to trigger the
> evaluation/recalculation of the cells. We implemented this shortcut now also
> in the properties explorer to re-trigger the re-calculation of formula and
> analysis curves. We'll also add this small improvement into the upcoming
> patch release. Thank you for this idea!

It will be welcome news when it arrives, I hope everything goes well and we can achieve the full realization of this project.

> If you want to give it a try earlier, you can try out our nightly builds.
> Additionally to the fixes that are also part of the next patch release, the
> new features and developments are documented on
> https://discuss.kde.org/t/labplot-post-v2-12-new-features-and-development-
> news/35074. If you have any other ideas or feedback, you can also reach out
> to us on Matrix.

Thank you for the kind offer. Trying the nightly version would be really interesting and perhaps an opportunity to contribute to the development of LabPlot as an active user. However, I feel I still need more experience with LabPlot before I can actually contribute, so for now I'll stick with the standard version.

I've also been checking out the proposals at https://discuss.kde.org/t/labplot-post-v2-12-new-features-and-development-news/35074. They are truly good recommendations, and I'm looking forward to seeing them in the new version.
Comment 10 Roger Júnio 2025-08-17 20:18:37 UTC
Also, a quick observation that I don't think I've made before—perhaps you've already made this note by now—the value of PI (π) is displayed in the selection menu as 3.14... (period as decimal separator), but the valid notation (at least in the settings used here) would currently be 3,14... (comma as decimal separator). The same is happening with other constants, such as Euler—perhaps due to differences in numerical notation depending on the user's language.

It's a more basic but inconvenient problem; having the numerical format of constants (and other numeric parameters) correct according to the language would be valuable.
Comment 11 Alexander Semke 2025-08-18 09:44:27 UTC
(In reply to Roger Júnio from comment #9)
> > The idea with Shift+Enter to recalculate the results is very nice and this
> > shortcut we have already in our notebook interface to trigger the
> > evaluation/recalculation of the cells. We implemented this shortcut now also
> > in the properties explorer to re-trigger the re-calculation of formula and
> > analysis curves. We'll also add this small improvement into the upcoming
> > patch release. Thank you for this idea!
> 
> It will be welcome news when it arrives, I hope everything goes well and we
> can achieve the full realization of this project.
We released today the patch 2.12.1:
https://labplot.org/2025/08/18/labplot-2-12-1-released
https://floss.social/@LabPlot/115048971322408800

Please check it once it's available in your distribution.
Comment 12 Roger Júnio 2025-08-18 16:42:57 UTC
Very good news!
By the way, there's no new update for LabPlot yet in the Arch repository mirrors, but I believe it will arrive soon.